Skip to content

feat: check a project with TypeScript 7 - #391

Closed
alexander-akait wants to merge 2 commits into
mainfrom
feat/typescript-7
Closed

alexander-akait wants to merge 2 commits into
mainfrom
feat/typescript-7

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

typescript@latest is 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 a TypeError with the bare name.

This PR runs the check on TS 7 through the API it ships, typescript/unstable/async. The new code is in src/checks/typescript-native.js.

  • Detection:
    • loadNative() reads the package's package.json. For major ≥ 7 it imports unstable/async, through the package's own exports.
    • Otherwise the existing path runs unchanged. A path to a module rather than a package, such as a test mock, also counts as classic.
  • A process of its own:
    • The API spawns the native compiler, so threads doesn't apply.
    • One client is kept per check and compiler: closed on shutdown or watchClose, or after a one-shot build.
  • Rebuilds: updateSnapshot() is handed webpack's modifiedFiles and removedFiles, split into changed, created and deleted, so nothing is read again to find out what changed. The previous snapshot is disposed.
  • Diagnostics:
    • Config-file, program, syntactic, global, declaration (when declaration or composite is set) and semantic diagnostics, honouring diagnosticOptions, and deduplicated.
    • Each is described as worker results already are, so ignoreDiagnostics, reportAs, formatter and outputReport work unchanged.
    • The default output is byte-for-byte what TypeScript 6's formatDiagnosticsWithColorAndContext prints for the bad fixture.
  • Unsupported, and reported as such rather than ignored: build, a mode that writes, and compiler options written in the plugin. The native API reads a project as its config file describes it.
  • Peer range: widened to ^5.0.0 || ^6.0.0 || ^7.0.0.

Measurements

600 .ts files (bench-heavy), one TypeScript check, default options.

one-shot wall webpack process CPU webpack process peak RSS watch: first build, then 3 rebuilds
TypeScript 6.0.3 3.47 / 3.54 s 6.4–6.5 s 382–384 MB 3.9 / 2.4 / 1.0 / 1.2 s
TypeScript 7.0.2 (this PR) 1.55 / 1.38 s 0.6–0.8 s 107–109 MB 1.4 / 0.7 / 0.7 / 0.7 s

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

  • The typescript7 alias: TS 7 is installed for the tests as typescript7@npm:typescript@7.0.2. Its bin is also named tsc and took over node_modules/.bin/tsc, so build:types and lint:types now run the repository's own TypeScript by path (node ./node_modules/typescript/bin/tsc).
  • test/typescript/native.test.js covers:
    • loading only for TS ≥ 7 packages;
    • a clean project;
    • a type error, with location, code frame and a file nothing imports;
    • ignoreDiagnostics;
    • diagnosticOptions;
    • a formatter written in the configuration;
    • the unsupported options;
    • a watch rebuild that fixes an error.
  • Lint, types, schema lint, prettier, cspell and the full suite (338 tests) pass locally.

Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for TypeScript 7, including compiler diagnostics during initial checks and watch-mode rebuilds.
  • Documentation
    • Added TypeScript 7 setup guidance and performance comparisons.
    • Documented limitations: build mode, writing mode, and compiler options configured directly in the plugin are not supported. Set compiler options in your TypeScript configuration file instead.

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
@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

CLA Not Signed

One or more co-authors of this pull request were not found. You must specify co-authors in commit message trailer via:

Co-authored-by: name <email>

Supported Co-authored-by: formats include:

  1. Anything <id+login@users.noreply.github.com> - it will locate your GitHub user by id part.
  2. Anything <login@users.noreply.github.com> - it will locate your GitHub user by login part.
  3. Anything <public-email> - it will locate your GitHub user by public-email part. Note that this email must be made public on Github.
  4. Anything <other-email> - it will locate your GitHub user by other-email part but only if that email was used before for any other CLA as a main commit author.
  5. login <any-valid-email> - it will locate your GitHub user by login part, note that login part must be at least 3 characters long.

Alternatively, if the co-author should not be included, remove the Co-authored-by: line from the commit message.

Please update your commit message(s) by doing git commit --amend and then git push [--force] and then request re-running CLA check via commenting on this pull request:

/easycla

@socket-security

socket-security Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedtypescript@​7.0.29910089100100

View full report

Copy link
Copy Markdown
Member Author

EasyCLA fails because the commits carry a Co-Authored-By: Claude trailer that maps to no GitHub account. It is not a code failure. Whether to drop the trailer or accept the check is for the maintainers to decide, so I haven't rewritten history.


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ 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: 038fd9eb-76c8-4315-8591-35a95508228e
📥 Commits

Reviewing files that changed from the base of the PR and between 51d5bfe and 743af82.

📒 Files selected for processing: 1
  • README.md

Walkthrough

The 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 51d5b

TypeScript 7 users may be misdirected when configuring the check. Clarify the guidance before merging; the documented issue does not establish a runtime failure.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding support for checking projects with TypeScript 7.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 6 files. (3 skipped: 3…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 6 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
📥 Commits

Reviewing files that changed from the base of the PR and between 0abded0 and 51d5bfe.

⛔ Files ignored due to path filters: 1
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing: 9
  • .changeset/typescript-7.md
  • README.md
  • package.json
  • src/checks/typescript-native.js
  • src/checks/typescript.js
  • test/typescript/fixtures/native-watch/index.js
  • test/typescript/native.test.js
  • types/checks/typescript-native.d.ts
  • types/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.

Comment thread README.md Outdated
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.

2 participants