Fix compatibility with TypeScript 6 or 7 - #1390
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
@pxseu is attempting to deploy a commit to the EGOIST's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
I've also confirmed that this patch unbreaks This looks like a very effective fix, since it still passes I'd like to implore the maintainers to merge this and include it in a release, rather than continuing to sit on it. |
tsup unconditionally sets baseUrl when generating .d.ts files, which triggers TS5101 in TypeScript 6. Adding ignoreDeprecations until tsup merges egoist/tsup#1390.
## Description Upgrade TypeScript from `5.9.3` to `6.0.3` across the monorepo. TS 6 is the last JS-based release before the Go-based TS 7 — this upgrade prepares the codebase for the eventual v7 migration. ### What changed **Version bump:** - pnpm catalog: `^5.9.3` → `^6.0.3` **Deprecated option removals (TS 6 deprecations → errors in TS 7):** - Removed `baseUrl` from 5 tsconfig files (playground-ui, playground, react SDK) — `paths` now resolves relative to the tsconfig without `baseUrl` - Removed `baseUrl` from 3 e2e test template tsconfigs (no-bundling, monorepo app, inner-tools) - Updated root `tsconfig.json` `moduleResolution` from `"Node"` (alias for deprecated `Node10`) to `"bundler"` **@types auto-discovery (TS 6 breaking change):** - Added `"types": ["node"]` to `tsconfig.node.json` (base config for most packages) - Added `"types": ["node"]` to standalone tsconfigs that don't extend `tsconfig.node.json` (`mcp-registry-registry`, `create-mastra`, `memory/integration-tests`, `playground/e2e/kitchen-sink`) - Added `"types": ["node"]` to e2e test templates (`commonjs`, `no-bundling`, `type-check`) **Build fixes:** - Patched `tsup@8.5.1` to fix `baseUrl` deprecation error in DTS builder (upstream [egoist/tsup#1388](egoist/tsup#1388), unmerged [fix PR #1390](egoist/tsup#1390)) - Fixed `convex` and `elasticsearch` `tsconfig.build.json` to properly extend local `tsconfig.json` (matching all other stores) **Code fixes:** - Removed 2 now-unused `@ts-expect-error` directives in `packages/core` for `ReadableStream` async iteration (natively supported in TS 6's ES2025 lib) - Added type assertion for `Response.json()` return in `mcp-docs-server` (now returns `Promise<unknown>` instead of `Promise<any>`) - Fixed type narrowing in `editor/processor-graph-hydrator.ts` for `.parallel()` and `.map()` calls ### Verified locally - **Full monorepo build**: 122/122 tasks pass — all `.d.ts` generation works correctly - **Typecheck**: all packages pass - **Lint**: 112/112 tasks pass - **E2E tests**: monorepo + no-bundling suites pass locally ## Type of Change - [x] Code refactoring ## Checklist - [x] I have made corresponding changes to the documentation (if applicable) - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have addressed all Coderabbit comments on this PR Link to Devin session: https://app.devin.ai/sessions/286c1e429f144e4eb8f4a69033a347fd Requested by: @TylerBarnes --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: tyler <tylerdbarnes@gmail.com>
egoist/tsup#1390 Signed-off-by: Philip Gerke <me@philipgerke.com>
|
Just ran into this and can confirm the PR fixes it. Tested with tsup 8.5.1 and typescript 6.0.3: dropping that One thing worth a look before merging: I'm assuming that fallback was there to help path-alias resolution in the dts build, so it'd be good to confirm alias-based builds still resolve. My repo doesn't use path aliases so I couldn't cover that case myself. Either way it'd be great to see this land. Right now |
The `ignoreDeprecations: "6.0"` line exists only because tsup's DTS build injects a default `baseUrl` (deprecated in TS 6, removed in TS 7). Reference the upstream tracking so we know when the workaround can go: egoist/tsup#1388, fixed by egoist/tsup#1390. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
## Why Move the monorepo onto TypeScript 6 (latest stable, `6.0.3`) from `5.9`. TS 6 is the transition release before TS 7 — it converts several soon-to-be-removed compiler options into **deprecation errors**, so upgrading now surfaces and lets us fix those ahead of the (breaking) TS 7 release. Staying on v6 for now, not v7. TypeScript is a `devDependency` in every package (build-time only, not shipped), so there is no runtime behavior change for users. ## What changed **Dependency** - `typescript` → `^6.0.3` in all 5 packages. - `ts-jest` → `^29.4.11` (its peer range now allows TS 6, and it no longer forces `node10` module resolution). **TS 6 deprecations fixed at the source (not just silenced)** - Removed no-op `downlevelIteration` from `tsconfig.base.json` (target is ES2022). - Removed deprecated `baseUrl`; rewrote `paths` mappings to be relative to each tsconfig (api, app, common-utils, hdx-eval). - Switched `hdx-eval` off deprecated `node10` resolution → `node16`. **New TS 6 requirements** - Added explicit `types: ["jest","node"]` + `rootDir` to `common-utils` (TS 6 changed auto-`@types` inclusion; hoisted root `@types` no longer auto-resolve). - Added `tests/*` path mapping and a `css.d.ts` ambient shim for plain `.css`/`.scss` side-effect imports — Next 16 only ships `*.module.css` types and TS 6 now enforces `TS2882` for untyped side-effect imports. **Tooling workarounds (scoped, documented)** - `ts-jest` transforms (api, app): explicit `rootDir` — TS 6 requires it when compiling a file subset per-file (`TS5011`). - api dev/e2e server runs via `ts-node`, which also hit `TS5011`; added a `ts-node.compilerOptions.rootDir` override (scoped to ts-node; the full `tsc` build keeps its multi-dir root). - `tsup` still hardcodes the now-deprecated `baseUrl` in its DTS build ([egoist/tsup#1388](egoist/tsup#1388), fix PR [#1390](egoist/tsup#1390) still open), so its DTS transform sets `ignoreDeprecations: "6.0"`. - `common-utils` eslint now ignores `*.config.ts` (parity with the existing `*.config.js`/`.mjs` ignores). Relevant upstream: TS 6 deprecation list [microsoft/TypeScript#54500](microsoft/TypeScript#54500), ts-jest TS 6 support [kulshekhar/ts-jest#4198](kulshekhar/ts-jest#4198) (shipped in 29.4.11). ## Verification - `make ci-lint` — ✅ 5 projects (lint + `tsc --noEmit`, 0 errors) - `make ci-unit` — ✅ common-utils (1406), cli (8), app (2272), hdx-eval (211) - Integration — ✅ api (`make dev-int`, 1716), common-utils (51) - E2E (`make e2e`) — ✅ 223 passed; the ts-node `TS5011` was caught and fixed here. Remaining failures were all pre-existing flaky timeouts (unrelated to TS) that pass in isolation. - Dev-mode dry run (`yarn dev`) — ✅ api (ts-node) `/health` 200, app (Next 16) ready, no TS errors. ## Notes - Branch prefix is `brandon/` rather than `claude/`/`agent/` because the worktree/branch was set up ahead of time; happy to rename if triage prefers.
|
Confirmed this resolves #1388. I applied this change (dropping One note for completeness: this diff only addresses the |
## Why Move the monorepo onto TypeScript 6 (latest stable, `6.0.3`) from `5.9`. TS 6 is the transition release before TS 7 — it converts several soon-to-be-removed compiler options into **deprecation errors**, so upgrading now surfaces and lets us fix those ahead of the (breaking) TS 7 release. Staying on v6 for now, not v7. TypeScript is a `devDependency` in every package (build-time only, not shipped), so there is no runtime behavior change for users. ## What changed **Dependency** - `typescript` → `^6.0.3` in all 5 packages. - `ts-jest` → `^29.4.11` (its peer range now allows TS 6, and it no longer forces `node10` module resolution). **TS 6 deprecations fixed at the source (not just silenced)** - Removed no-op `downlevelIteration` from `tsconfig.base.json` (target is ES2022). - Removed deprecated `baseUrl`; rewrote `paths` mappings to be relative to each tsconfig (api, app, common-utils, hdx-eval). - Switched `hdx-eval` off deprecated `node10` resolution → `node16`. **New TS 6 requirements** - Added explicit `types: ["jest","node"]` + `rootDir` to `common-utils` (TS 6 changed auto-`@types` inclusion; hoisted root `@types` no longer auto-resolve). - Added `tests/*` path mapping and a `css.d.ts` ambient shim for plain `.css`/`.scss` side-effect imports — Next 16 only ships `*.module.css` types and TS 6 now enforces `TS2882` for untyped side-effect imports. **Tooling workarounds (scoped, documented)** - `ts-jest` transforms (api, app): explicit `rootDir` — TS 6 requires it when compiling a file subset per-file (`TS5011`). - api dev/e2e server runs via `ts-node`, which also hit `TS5011`; added a `ts-node.compilerOptions.rootDir` override (scoped to ts-node; the full `tsc` build keeps its multi-dir root). - `tsup` still hardcodes the now-deprecated `baseUrl` in its DTS build ([egoist/tsup#1388](egoist/tsup#1388), fix PR [#1390](egoist/tsup#1390) still open), so its DTS transform sets `ignoreDeprecations: "6.0"`. - `common-utils` eslint now ignores `*.config.ts` (parity with the existing `*.config.js`/`.mjs` ignores). Relevant upstream: TS 6 deprecation list [microsoft/TypeScript#54500](microsoft/TypeScript#54500), ts-jest TS 6 support [kulshekhar/ts-jest#4198](kulshekhar/ts-jest#4198) (shipped in 29.4.11). ## Verification - `make ci-lint` — ✅ 5 projects (lint + `tsc --noEmit`, 0 errors) - `make ci-unit` — ✅ common-utils (1406), cli (8), app (2272), hdx-eval (211) - Integration — ✅ api (`make dev-int`, 1716), common-utils (51) - E2E (`make e2e`) — ✅ 223 passed; the ts-node `TS5011` was caught and fixed here. Remaining failures were all pre-existing flaky timeouts (unrelated to TS) that pass in isolation. - Dev-mode dry run (`yarn dev`) — ✅ api (ts-node) `/health` 200, app (Next 16) ready, no TS errors. ## Notes - Branch prefix is `brandon/` rather than `claude/`/`agent/` because the worktree/branch was set up ahead of time; happy to rename if triage prefers.
## Description Upgrade TypeScript from `5.9.3` to `6.0.3` across the monorepo. TS 6 is the last JS-based release before the Go-based TS 7 — this upgrade prepares the codebase for the eventual v7 migration. ### What changed **Version bump:** - pnpm catalog: `^5.9.3` → `^6.0.3` **Deprecated option removals (TS 6 deprecations → errors in TS 7):** - Removed `baseUrl` from 5 tsconfig files (playground-ui, playground, react SDK) — `paths` now resolves relative to the tsconfig without `baseUrl` - Removed `baseUrl` from 3 e2e test template tsconfigs (no-bundling, monorepo app, inner-tools) - Updated root `tsconfig.json` `moduleResolution` from `"Node"` (alias for deprecated `Node10`) to `"bundler"` **@types auto-discovery (TS 6 breaking change):** - Added `"types": ["node"]` to `tsconfig.node.json` (base config for most packages) - Added `"types": ["node"]` to standalone tsconfigs that don't extend `tsconfig.node.json` (`mcp-registry-registry`, `create-mastra`, `memory/integration-tests`, `playground/e2e/kitchen-sink`) - Added `"types": ["node"]` to e2e test templates (`commonjs`, `no-bundling`, `type-check`) **Build fixes:** - Patched `tsup@8.5.1` to fix `baseUrl` deprecation error in DTS builder (upstream [egoist/tsup#1388](egoist/tsup#1388), unmerged [fix PR mastra-ai#1390](egoist/tsup#1390)) - Fixed `convex` and `elasticsearch` `tsconfig.build.json` to properly extend local `tsconfig.json` (matching all other stores) **Code fixes:** - Removed 2 now-unused `@ts-expect-error` directives in `packages/core` for `ReadableStream` async iteration (natively supported in TS 6's ES2025 lib) - Added type assertion for `Response.json()` return in `mcp-docs-server` (now returns `Promise<unknown>` instead of `Promise<any>`) - Fixed type narrowing in `editor/processor-graph-hydrator.ts` for `.parallel()` and `.map()` calls ### Verified locally - **Full monorepo build**: 122/122 tasks pass — all `.d.ts` generation works correctly - **Typecheck**: all packages pass - **Lint**: 112/112 tasks pass - **E2E tests**: monorepo + no-bundling suites pass locally ## Type of Change - [x] Code refactoring ## Checklist - [x] I have made corresponding changes to the documentation (if applicable) - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have addressed all Coderabbit comments on this PR Link to Devin session: https://app.devin.ai/sessions/286c1e429f144e4eb8f4a69033a347fd Requested by: @TylerBarnes --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: tyler <tylerdbarnes@gmail.com>
Fixes:
#1389
#1388
Tested as a monkey patch here:
pxseu/fami@08c396d
https://github.com/pxseu/fami/actions/runs/23560643308/job/68599308721#step:5:9