Migrate type-checking and declaration build to TypeScript v7#8805
Open
pubkey wants to merge 2 commits into
Open
Migrate type-checking and declaration build to TypeScript v7#8805pubkey wants to merge 2 commits into
pubkey wants to merge 2 commits into
Conversation
Run check-types, the .d.ts declaration build and the public typings test on the native TypeScript v7 compiler (typescript@7.0.2). The native v7 `typescript` package only ships the new `./unstable/*` API and no longer exposes the classic compiler API that typescript-eslint and ts-loader depend on. To keep lint and the landingpage webpack build working, the classic typescript@5.9.3 is kept as the top-level `typescript` dependency (used only by those tools via node module resolution) while the v7 compiler is added as an aliased `typescript7` dependency and invoked by explicit path from the `tsc7` script. Changes: - add `typescript7` (npm:typescript@7.0.2) and a `tsc7` helper script - point `check-types`, `build:types` and `test:typings` at the v7 compiler - set `rootDir` explicitly in config/tsconfig.types.json, required by v7 - pass `--ignoreConfig` in `test:typings` since v7 errors when files are given on the command line while a tsconfig.json is present The v7 declaration emit was verified to be semantically identical to the v5 output (differences are only union-member ordering, quote style and `any | undefined` vs `any` on optional params). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NME9TqXAZuxvVbji4vSK5G
Upgrade @typescript-eslint/parser and @typescript-eslint/eslint-plugin from 8.63.0 to the latest stable 8.64.0. Note: this does not remove the dual-TypeScript setup. Even the latest typescript-eslint still requires the classic compiler API (peer `typescript >=4.8.4 <6.1.0`) and does not yet support the TypeScript v7 native API, so typescript@5.9.3 stays as the lint-only TypeScript. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NME9TqXAZuxvVbji4vSK5G
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains
Describe the problem you have without this PR
The project type-checked, generated its shipped
.d.tsfiles and ran the public typings test on TypeScript v5. This PR moves that pipeline to the native TypeScript v7 compiler (typescript@7.0.2).The constraint
The native v7
typescriptpackage only ships the new./unstable/*API. It no longer exposes the classic compiler API (ts.createProgram,ts.Extension, etc.) thattypescript-eslintandts-loaderrely on. As of today no releasedtypescript-eslintsupports the v7 native API (latest still pinstypescript >=4.8.4 <6.1.0), and swapping the top-leveltypescriptto v7 crashesnpm run lintat load (Cannot read properties of undefined (reading 'Cjs')) and would break the landingpagets-loaderbuild.The approach
Run a dual setup during the transition:
typescript@5.9.3stays as the top-leveltypescriptdependency, used only bytypescript-eslintandts-loaderthrough node module resolution.typescript7(npm:typescript@7.0.2) dependency and invoked by explicit path from a newtsc7script (its owntscbin name collides with the classic one).check-types,build:typesandtest:typingsnow run on v7.Config adjustments required by v7
config/tsconfig.types.json: setrootDir: "../src"explicitly. v7 no longer infers the common source directory and otherwise errors withTS6059/TS5011.test:typings: added--ignoreConfig. v7 errors (TS5112) when files are passed on the command line while atsconfig.jsonis present; oldertscsilently ignored the config in that case.Verification
npm run check-types(v7): passes, 0 errorsnpm run buildincludingbuild:types(v7): passesnpm run test:typings(v7): passes, 0 errorsnpm run lint(classic v5 fortypescript-eslint): passesnpm run test:fast:memory: 1072 passing (the single unrelated failure isreplication-webrtc.test.ts, whosenode-datachannelnative addon cannot be compiled in this sandbox; independent of TypeScript)1 | -1→-1 | 1), quote style ("x"→'x') andany | undefined→anyon optional params.Todos
🤖 Generated with Claude Code
https://claude.ai/code/session_01NME9TqXAZuxvVbji4vSK5G
Generated by Claude Code