Skip to content

Upgrade TypeScript to 7 (build failing — needs review) - #1084

Draft
woksin wants to merge 1 commit into
mainfrom
chore/typescript-7
Draft

Upgrade TypeScript to 7 (build failing — needs review)#1084
woksin wants to merge 1 commit into
mainfrom
chore/typescript-7

Conversation

@woksin

@woksin woksin commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Upgrades Fundamentals to TypeScript 7.0.2 (the native compiler). The pure typecheck/compile path (tsc -b) works cleanly with TS7, but two third-party tools in the build/lint pipeline are not yet compatible with the TS7 native package, so the full CI (yarn ci) and publish (yarn build) currently fail. Opening for review — see Blockers below.

Package changes (old → new)

Package Field Old New
root package.json devDependencies.typescript 6.0.3 7.0.2
root package.json packageManager yarn@4.5.3 yarn@4.17.1
.yarnrc.yml yarnPath yarn-4.5.3.cjs yarn-4.17.1.cjs

Source/ESLintConfig/package.json declares typescript only as a peerDependency (>=4.8.4) — left unchanged, as instructed (don't force consumers). No @types/* touched.

Why Yarn was bumped

Installing typescript@7.0.2 with Yarn 4.5.3 fails outright: Yarn's builtin TypeScript compat patch has a catch-all hunk gated >=5.7.1-rc (no upper bound) that renames lib/_tsc.js — a file the native compiler no longer ships — causing ENOENT during the fetch step. Yarn 4.17.1 is the first release that caps this range at >=5.7.1-rc <7.0.0-0, making the patch a no-op for TS7 so install succeeds. This bump is a hard prerequisite for the version bump, not optional.

Package manager

Yarn (workspaces, nodeLinker: node-modules). yarn install succeeds on 4.17.1. yarn.lock is gitignored in this repo, so it is not part of the diff.

Verification

  • yarn install (Yarn 4.17.1): success.
  • tsc --version resolves to 7.0.2; ts.version === "7.0.2".
  • tsc -b on @cratis/fundamentals (Source/JavaScript): passes — exit 0, 31 .js + 31 .d.ts emitted. TS7 typechecking/compilation is clean.
  • yarn ci / yarn build: fail at the lint and bundle steps (see Blockers).

Blockers (build failing — needs review)

The TS7 native typescript npm package is currently a thin wrapper over the Go binary and does not expose the full programmatic compiler API — ts.Extension, ts.ModuleKind, createDocumentRegistry, etc. are undefined. Tools that consume those internals break:

  1. Lint@typescript-eslint/typescript-estree@8.62.0 throws TypeError: Cannot read properties of undefined (reading 'Cjs') (reads ts.Extension.Cjs). typescript-eslint 8.x officially supports typescript <6.1.0; no TS7-compatible release exists yet.
  2. Bundlerollup-plugin-typescript2@0.37.0 (already the latest) throws TypeError: tsModule.createDocumentRegistry is not a function. The plugin uses the TS LanguageService API, absent from the native package.

Neither is fixable by a version bump today; both need upstream TS7 support (or a switch to different lint/bundle tooling), which is out of scope for a version bump. The typescript@7.0.2 + Yarn 4.17.1 changes are kept so the work is ready to land once the ecosystem catches up.

Workflow changes

None. .github/workflows/ was grepped for explicit typescript version pins and tsc install steps — there are none (workflows only pin NODE_VERSION and call yarn ci / yarn build). No workflow edits required.

🤖 Generated with Claude Code

Update Fundamentals to TypeScript 7 (the native compiler) for improved
build/typecheck performance.

Bump the pinned Yarn release from 4.5.3 to 4.17.1 as well: 4.17.1 is the
first Yarn version whose builtin TypeScript compat patch caps its version
range at <7.0.0-0, so installing typescript@7.0.2 no longer fails while
Yarn tries to patch files (lib/_tsc.js) that the native compiler no
longer ships.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@woksin
woksin marked this pull request as draft July 10, 2026 09:24
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