Skip to content

Migrate to TC39 Stage 3 modern decorators (v9.0)#840

Open
lbwexler wants to merge 10 commits into
developfrom
tc39-decorators
Open

Migrate to TC39 Stage 3 modern decorators (v9.0)#840
lbwexler wants to merge 10 commits into
developfrom
tc39-decorators

Conversation

@lbwexler

Copy link
Copy Markdown
Member

Summary

Mirrors the hoist-react v85 / hoist-dev-utils v14 decorator migration across toolbox's client-app (xh/hoist-react#4321). Serves as the canary for the framework migration.

Requires sibling hoist-react branch tc39-decorators (v85.0.0-SNAPSHOT) and hoist-dev-utils branch tc39-decorators (v14.0.0-SNAPSHOT) at release time.

Commits

  • b39f5504 Migrate to TC39 Stage 3 modern decorators (toolbox v9.0) — removed experimentalDecorators from client-app/tsconfig.json, applied the accessor codemod (273 sites across 80 files), removed makeObservable(this) calls (88), empty constructors (43), and unused imports (87). Also added *.png to client-app/src/types.d.ts to resolve pre-existing sibling-checkout type-resolution errors that were blocking the pre-commit hook.
  • 97a6f0c6 TC39 follow-up: codemod extensions + stray class-level @Managed — re-ran the extended codemod (10 more sites in ViewManagerTestModel), removed a stray class-level @managed on SimpleRoutingPanelModel (pre-existing bug that legacy decorators silently no-op'd).

Test plan

  • yarn tsc --noEmit clean, yarn lint:code clean.
  • Manual smoke of primary apps (/app, /admin, /mobile) and example apps (/todo, /contact, /portfolio, /news, /recalls, /fileManager, /weather).
  • Audit Object.keys(model) / JSON.stringify(model) / {...model} sites per the v85 upgrade-notes grep commands — verify no regressions from accessor-field non-enumerability.

🤖 Generated with Claude Code

lbwexler and others added 2 commits April 15, 2026 16:24
Mirrors the hoist-react v85 / hoist-dev-utils v14 decorator migration across toolbox's client-app (xh/hoist-react#4321):

- Removed `experimentalDecorators` from `client-app/tsconfig.json`
- Applied codemod `hoist-react/docs/planning/tc39-decorators/codemod-add-accessor.mjs` — inserted 273 `accessor` keywords across 80 files
- Applied `codemod-remove-makeObservable.mjs` — removed 88 `makeObservable(this)` calls, 43 newly-empty constructors, and 87 unused `makeObservable` imports
- Hand-fixed `admin/tests/grids/GridTestModel.ts:64` where an inline comment between stacked `@bindable` / `@persist.with(...)` decorators prevented codemod regex matching

Also added `*.png` to `client-app/src/types.d.ts` — `yarn run tsc` had been failing on pre-existing PNG module-resolution errors from `../../hoist-react/cmp/spinner/Spinner.ts` etc. (they leak in via the `@xh/hoist/*` paths alias, but hoist-react's own `assets.d.ts` isn't visible to toolbox's tsc project). This fix is orthogonal to the TC39 migration but unblocks the pre-commit hook.

Requires sibling `hoist-react` branch `tc39-decorators` (v85.0.0-SNAPSHOT) and `hoist-dev-utils` branch `tc39-decorators` (v14.0.0-SNAPSHOT) for runtime — coordinated release required.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Matches the hoist-react v85 follow-up (d68ffdfc2).

- Re-ran `codemod-add-accessor.mjs` after extending its regex for `@decorator @observable.ref foo` pre-decorator patterns — picked up 10 additional sites in `ViewManagerTestModel`.
- Removed stray class-level `@managed` on `SimpleRoutingPanelModel`. Pre-existing bug that legacy decorators silently no-op'd; TC39 throws a clearer "kind='class'" error.
- Carries the `experimentalDecorators: true` removal from `client-app/tsconfig.json` that was missed in the initial toolbox migration commit (b39f550).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lbwexler lbwexler requested review from amcclain and haynesjm42 April 15, 2026 21:55
@lbwexler lbwexler marked this pull request as ready for review April 17, 2026 00:47
# Conflicts:
#	client-app/src/core/svc/DocService.ts
#	client-app/src/core/svc/GitHubService.ts
#	client-app/src/desktop/tabs/forms/FormPanelModel.ts
#	client-app/src/desktop/tabs/forms/PickerPanel.ts
#	client-app/src/examples/news/NewsPanelModel.ts
#	docker/tomcat/Dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant