Repository navigation
perf(deps-dev): use native TypeScript for Vitest checks - #388
Merged
Merged
Conversation
commit: |
Contributor
There was a problem hiding this comment.
No issues found across 7 files
Auto-approved: Bounded dev-tooling change: Vitest type checks now use native TS 7.0.2 via an explicit checker path while TS 5.9.3 is pinned for consumer checks; lockfile, docs, and knip config updated with no runtime or public-surface impact.
View guided diff | Turn on auto-fix | Re-trigger cubic
Contributor
Author
|
s2d2 fix pass (requested by guillaume@stackone.com in Slack): this branch had no CI runs (head was a month old and its runs were gone). Merged current main into it (clean, no conflicts) so CI runs on a fresh head. Locally on the merged head: frozen install ok, vitest root project (native tsc typecheck) 1310 passed, knip exits 0. |
…pt-checks Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> # Conflicts: # knip.config.ts
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.
Change
Run the existing Vitest type checks with stable native TypeScript 7.0.2 through an explicit executable path. Pin the already-locked TypeScript 5.9.3 as a direct dev dependency for compiler API consumers and the published-package Node16 consumer test. This prevents either check from accidentally selecting a host-global or ambiguous
tscbinary.The existing tsdown/native-preview declaration build, runtime code, compiler strictness, Nix tools and CI workflows remain unchanged. Knip is told about the executable dependency it cannot discover from a file-path string. All 429 existing package records and 429 snapshots, including runtime/security policies, are unchanged; only 21 official stable compiler/platform records are added.
Local benchmark
Measured Vitest's root typechecking job only, including Vitest startup and result parsing. This excludes runtime tests, dependency installation, declaration builds and hosted CI overhead; it is not an application-runtime or end-to-end CI speed claim.
Same final source/dependency graph and Node v24.21.0, macOS arm64. Two warmup rounds followed by seven measured pairs; alternate compiler order. Each cold run removes Vitest's
tsconfig.tmp.tsbuildinfo, then its warm run reuses that compiler's cache. All 36 invocations pass with 20 typechecked test files,413 passed (417)and no type errors. The actual compiler version is verified from build-info after every invocation. Both compilers cover the same 59 project files and 1,146 dependency module-files, matched by package name/version, relative path and SHA-256. TS 5.9 additionally reports three identical Undici aliases, including an ancestor copy of exactly the sameundici-types@6.21.0entry point; there is no missing declaration coverage.Audit workers were paused during timing. Host 1-minute load changed from 3.25 to 4.90; unrelated host work was not controlled. Cold ranges: legacy 1.548681–1.687273s, native 0.580724–0.641551s. Cached ranges: legacy 0.933433–1.008242s, native 0.473459–0.525081s.
Raw measured wall-clock seconds and reproduction
{ "cold": { "legacy": [ 1.647859, 1.600274917, 1.605859209, 1.687272625, 1.548681333, 1.582628083, 1.565835375 ], "native": [ 0.580724083, 0.641550834, 0.633643541, 0.59531525, 0.6077735, 0.623569625, 0.602699834 ] }, "warm": { "legacy": [ 0.945776709, 0.93343275, 1.008241916, 0.94799475, 0.94301525, 0.953216542, 0.942659542 ], "native": [ 0.525080916, 0.518334542, 0.473459333, 0.525013834, 0.514120167, 0.501108833, 0.506509125 ] } }Create two temporary root configs that import the final
vitest.config.ts, clone its config, and select only the existing root project's typechecking stage. Set the checker to./node_modules/typescript/bin/tscfor legacy or./node_modules/@typescript/native/bin/tscfor native:Run each using the repository-managed Node binary, for example:
Vitest itself passes its existing
--noEmit --pretty false --incremental --tsBuildInfoFile <vitest>/dist/tsconfig.tmp.tsbuildinfoarguments. Remove that build-info before cold checks; run the identical command immediately afterward for the cached check. Temporary configs are removed after measurement. Workspace project configuration overrides the similarly named global CLI flags, so the benchmark uses actual per-project checker settings rather than those ignored CLI overrides.Validation and limits
pnpm test: 45 files passed,1288 passed (1292), no type errors. This includes existing runtime/mocked HTTP tests, examples and CJS/ESM/Node16 package-consumer checks. The initial local baseline found a host-global TypeScript 5.1.6; the accepted baseline explicitly selected the lockfile's 5.9.3 in an untracked local binary link. No tests were removed or weakened.pnpm buildand package validation pass. 154/156 outputs are byte-identical. The only differences arepackage.cjs.mapandpackage.mjs.map: the exact changed package manifest insourcesContentand its corresponding mappings. All runtime JS and declarations are identical.watch: false; ongoing edit/rebuild behaviour was not benchmarked.pnpm lint:knippasses with the same two pre-existing configuration hints. Full localpnpm lintis not passed: this host lacks Nix's pinned Oxfmt/Oxlint executables (exit 127). An exact-version recovery was attempted, but the old platform metadata was unavailable; the unchanged hosted Nix lint job has now passed: Oxfmt checked 96 files, type-aware/type-checking Oxlint checked 66 files with 104 rules and no warnings/errors, and Knip passed with the same two hints. Hosted build/test also passed with the same 45 files and1288 passed (1292); all three AI peer-range jobs (5.0.108, 6.0.7, 7.0.0), pinned Python/Node conformance andci-okpassed.pnpm install --frozen-lockfilesucceeds under pinned pnpm10.26.0, preserving the existing Node runtime and lifecycle/security policies. The lockfile's 21 new records were generated normally in a minimal compiler-only fixture using official cached registry metadata, then added to the unchanged existing graph. Full root nonfrozen generation could not start through the available network transport; this is not claimed as a full root resolver run. No peer snapshots were guessed or rewritten.The existing declaration native-preview upgrade is deferred: the wrapper interface looked compatible, but normal peer-graph re-resolution could not be proven with the available metadata. This PR claims the measured Vitest improvement only.
Hosted review and security
At head
2c2643eb8a0f2c6d223d1bc34e1c26a3df664fd5, Cubic approved all seven files without findings; there are no inline review threads or unanswered findings. Copilot did not review because its quota was exhausted, so its failed check is not a code failure or a clean review. It was not retriggered.Hosted CI, Gitleaks (no leaks found), Aikido, dry-publish and the repository's existing automatic release-artifact checks passed. Coverage/deploy-coverage jobs were skipped by their existing branch conditions. GitHub security overview shows Dependabot enabled, code scanning needing setup, and secret scanning/code quality disabled; no alert count was shown. These unavailable scanners are not claimed as passed. No security settings were changed and no manual deployment or merge was performed.
Summary by cubic
Switches Vitest type checks to run with native TypeScript 7.0.2 via an explicit checker path, and pins TypeScript 5.9.3 as a direct dev dependency so compiler API consumers and the published-package consumer test keep using the JS compiler. Both compilers are now invoked through explicit binaries, so checks no longer risk selecting a host-global or ambiguous
tsc.Runtime code, declaration builds, compiler strictness, Nix tooling, CI workflows, and all test/security records are unchanged; only 21 official TypeScript compiler platform records are added to the lockfile. Build output is byte-identical except for the two source maps that embed the changed package manifest. Knip is configured to allow the native checker dependency, which it cannot discover from a file-path string.
Performance
Written for commit 326ed4e. Summary will update on new commits.