Repository navigation
feat: check a project with TypeScript 7 - #391
alexander-akait wants to merge 2 commits into
Conversation
TypeScript 7 is a native compiler with no compiler API in JavaScript: importing it yields its version and nothing else, so the TypeScript check could not run at all. The check now drives the native compiler through the API it ships (typescript/unstable/async), in a process of its own that stays open while webpack watches and is told which files webpack saw change. Diagnostics are printed as tsc --pretty prints them. build, a writing mode, and compiler options written in the plugin are reported as unsupported, since the native API reads a project as its config file describes it. TypeScript 7 is installed for the tests under the typescript7 alias. Its bin is also named tsc, so the scripts run the repository's own TypeScript by path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01App18sYbe6Vf6HDCjCXbvf
One or more co-authors of this pull request were not found. You must specify co-authors in commit message trailer via: Supported
Alternatively, if the co-author should not be included, remove the Please update your commit message(s) by doing |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
EasyCLA fails because the commits carry a Generated by Claude Code |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
WalkthroughThe TypeScript check now uses TypeScript 7’s native asynchronous API when available. The new implementation manages compiler clients and snapshots, collects and formats diagnostics, and handles watch rebuilds. It rejects build mode, output-writing modes, and plugin-level compiler options. Package metadata, documentation, and tests now cover TypeScript 7 support. Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
9a5e2a08-07c9-45f4-8fc4-0e49db6bff77
⛔ Files ignored due to path filters: 1
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing: 9
.changeset/typescript-7.mdREADME.mdpackage.jsonsrc/checks/typescript-native.jssrc/checks/typescript.jstest/typescript/fixtures/native-watch/index.jstest/typescript/native.test.jstypes/checks/typescript-native.d.tstypes/checks/typescript.d.ts
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01App18sYbe6Vf6HDCjCXbvf
Summary
typescript@latestis now 7.0.2, a native compiler with no compiler API in JavaScript:import("typescript")yields only{ version, versionMajorMinor }. On main, the TypeScript check therefore fails outright with TS 7, with "Directory import … is not supported" when given a path and aTypeErrorwith the bare name.This PR runs the check on TS 7 through the API it ships,
typescript/unstable/async. The new code is insrc/checks/typescript-native.js.loadNative()reads the package'spackage.json. For major ≥ 7 it importsunstable/async, through the package's own exports.threadsdoesn't apply.shutdownorwatchClose, or after a one-shot build.updateSnapshot()is handed webpack'smodifiedFilesandremovedFiles, split intochanged,createdanddeleted, so nothing is read again to find out what changed. The previous snapshot is disposed.declarationorcompositeis set) and semantic diagnostics, honouringdiagnosticOptions, and deduplicated.ignoreDiagnostics,reportAs,formatterandoutputReportwork unchanged.formatDiagnosticsWithColorAndContextprints for thebadfixture.build, amodethat writes, and compiler options written in the plugin. The native API reads a project as its config file describes it.^5.0.0 || ^6.0.0 || ^7.0.0.Measurements
600
.tsfiles (bench-heavy), one TypeScript check, default options.The native compiler's own CPU isn't in the webpack-process column. Measured alone with
tsc -p --noEmit, the native compiler takes 1.1–1.3 s user + 0.4 s sys on this project, against 4.8 + 0.3 s for TypeScript 6.Tests and tooling
typescript7alias: TS 7 is installed for the tests astypescript7@npm:typescript@7.0.2. Its bin is also namedtscand took overnode_modules/.bin/tsc, sobuild:typesandlint:typesnow run the repository's own TypeScript by path (node ./node_modules/typescript/bin/tsc).test/typescript/native.test.jscovers:ignoreDiagnostics;diagnosticOptions;Generated by Claude Code
Summary by CodeRabbit