build(web): migrate to TypeScript 7 (retire tsgo bridge) - #681
Conversation
…pescript/typescript6 Bump the web workspace to the official TS 7 (native/Go) compiler and retire the @typescript/native-preview (tsgo) bridge: now that TS 7's `tsc` IS the native compiler, the dual typecheck/typecheck:go setup collapses onto one engine, and local pre-push matches CI. - pnpm-workspace catalog: typescript ^6.0.0 -> ~7.0.0 (pin minor: a compiler minor can shift diagnostics); drop @typescript/native-preview - studio/common/testing/scripts: remove native-preview dep and the typecheck:go scripts - .pre-commit-config: point the studio-typecheck pre-push hook at `typecheck` (now native), identical to CI Why the `typescript` override in web/package.json: typescript-eslint -- and every ESLint plugin that transitively pulls @typescript-eslint/typescript-estree (@eslint-react/*, @TanStack, @vitest, testing-library) -- declares a `typescript >=4.8.4 <6.1.0` peer and reads `ts.Extension.Cjs` at import time. TS 7.0 does not expose that programmatic API (a stable one lands in TS 7.1), so lint crashes on load with "Cannot read properties of undefined (reading 'Cjs')". No published typescript-eslint (incl. canary) supports TS 7 yet -- upstream tracking issue #12518 is closed as not-planned -- so a version bump cannot fix this. Bridge per the TS 7.0 release guidance: give the linter the TS-6 compiler API only, via a root `typescript` -> npm:@typescript/typescript6 alias. Root-level ESLint plugins (direct deps of nemo-studio) resolve their peer to the in-range 6.x API, while each sub-package keeps its own typescript@7 for `tsc` -- so typecheck and CI run native TS 7 unchanged. Scoped pnpm `parent>child` overrides do NOT work here (they target dependency edges, not peer resolution). Remove this alias once typescript-eslint ships TS 7.1 support. Signed-off-by: Alex Ray <[email protected]>
intakeTelemetry.ts and its test still read evaluation_run_id, evaluation_sha, and metadata from SpanEvaluationContext. The OpenAPI source of truth retired those keys (ingest endpoints keep accepting them via extra="ignore", but they are no longer part of the canonical shape), and the generated SDK dropped them -- so the studio typecheck failed with TS2339/2551/2353. Read only the current keys (evaluation_id, test_case_id), unblocking the studio `typecheck` gate alongside the TypeScript 7 migration. Signed-off-by: Alex Ray <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe web workspace replaces ChangesTypeScript typecheck standardization
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.pre-commit-config.yaml:
- Line 126: Update the pre-push instructions in DEVELOPMENT.md to replace the
retired typecheck:go command and native-port reference with the current
typecheck command, matching the command used by the pre-commit configuration
entry.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f7272a5b-cd40-4a4e-bdf1-9bf7a806c501
⛔ Files ignored due to path filters (1)
web/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
.pre-commit-config.yamlweb/package.jsonweb/packages/common/package.jsonweb/packages/scripts/package.jsonweb/packages/studio/package.jsonweb/packages/studio/src/components/IntakeDetail/IntakeComponents/spanKeyValues.test.tsxweb/packages/studio/src/util/intakeTelemetry.tsweb/packages/testing/package.jsonweb/pnpm-workspace.yaml
💤 Files with no reviewable changes (2)
- web/packages/scripts/package.json
- web/packages/studio/package.json
|
Follow-up to the TypeScript 7 migration, which removed the typecheck:go scripts. Update the docs that still referenced them: - DEVELOPMENT.md pre-push section: describe the actual hook command (pnpm --filter="...[origin/main]" run --parallel --if-present typecheck) and drop the obsolete "TypeScript native port" link -- TS 7's tsc is the native compiler. - test-coverage-improvement skill: remove the "typecheck:go (if present)" hedges now that the script no longer exists. Signed-off-by: Alex Ray <[email protected]>
Only conflict was web/pnpm-lock.yaml (vitest peer-resolution keys): main uses plain [email protected], our branch uses the @typescript/typescript6 eslint bridge alias. Resolved by regenerating the lockfile from the merged web/package.json, which retains both our `typescript` alias and main's new brace-expansion override. Validated: pnpm install --frozen-lockfile, pnpm lint, and recursive typecheck (tsc 7.0.2) all green. Signed-off-by: Alex Ray <[email protected]>
What
Migrates the
web/workspace to the official TypeScript 7 (native/Go) compiler and retires the@typescript/native-preview(tsgo) bridge. Now that TS 7'stscis the native compiler, the old dualtypecheck/typecheck:gosetup collapses onto one engine and local pre-push runs the identical compiler as CI.typescript ^6.0.0→~7.0.0(pin the minor — a compiler minor can shift diagnostics); drop@typescript/native-previewstudio/common/testing/scripts: remove the native-preview dep and thetypecheck:goscripts.pre-commit-config.yaml: point thestudio-typecheckpre-push hook attypecheck(now native), matching CISpanEvaluationContextkeys inintakeTelemetry.ts(unblocks the studio typecheck gate — see below)Why the
typescriptoverride inweb/package.jsonThis is the non-obvious part.
web/package.jsongains:It does not downgrade the compiler. It exists solely to keep ESLint working under TS 7:
typescript-eslint— and every ESLint plugin that transitively pulls@typescript-eslint/typescript-estree(@eslint-react/*,@tanstack/eslint-plugin-query,@vitest/eslint-plugin,eslint-plugin-testing-library) — declares atypescript >=4.8.4 <6.1.0peer and readsts.Extension.Cjsat import time.TypeError: Cannot read properties of undefined (reading 'Cjs').typescript-eslintsupports TS 7 yet —latest(8.63.0) and even thecanarychannel all cap at<6.1.0, and the upstream tracking issue (typescript-eslint#12518) is closed as not planned. A version bump cannot fix this.Per the TS 7.0 release guidance, the fix is to hand the linter the TS-6 compiler API only via a root
typescript→@typescript/typescript6alias (a package that re-exports the full TS-6 library API, resolving to[email protected]):nemo-studio) resolve theirtypescriptpeer to the in-range 6.x API.typescript@7, sotsctypecheck and CI run native TS 7, unchanged.pnpm -C web exec tscat the root reports 6.0.3 — nothing uses root-leveltsc; all typecheck is per-package on 7.Scoped pnpm
parent>childoverrides were tried first and do not work here — they target dependency edges, not peer resolution, and leave[email protected]peer-variants that still crash. The root-provider alias is the mechanism that actually steers peer resolution.This alias is a temporary bridge — remove it once
typescript-eslintships TS 7.1 support.Second commit — retired SpanEvaluationContext keys
intakeTelemetry.ts(+ its test) still readevaluation_run_id/evaluation_sha/metadata, which the OpenAPI schema retired and the generated SDK dropped — so studio typecheck failed with TS2339/2551/2353 independently of the compiler swap. Ingest endpoints still accept those keys viaextra="ignore"; the UI just stops reading them. Included here so the studiotypecheckgate (pre-push + CI) is green.Verification (from
web/)pnpm lint(CIweb-lint)pnpm run -r --if-present lintpnpm install --frozen-lockfile(CI install)pnpm run -r --parallel typechecktsc= 7.0.2)studio-typecheckhookCI (
.github/workflows/ci.yaml) is untouched — it already callstypecheck, now transparently native.Summary by CodeRabbit