Repository navigation
ci: Measure the type-check budget with TypeScript 7 - #4192
Conversation
check:typeperf used the TS 6 JS API (require('typescript') resolves to
@typescript/typescript6) while the repo builds with @typescript/native 7.
It now spawns the repo's tsc with --extendedDiagnostics and reads the
Instantiations line, failing on a non-zero exit. budget.json is
re-recorded as a TypeScript 7.0.2 baseline.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFo5AAtZp18HcwiXBqBDEZ
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4192 +/- ##
=======================================
Coverage 98.09% 98.09%
=======================================
Files 165 165
Lines 3143 3143
Branches 625 625
=======================================
Hits 3083 3083
Misses 18 18
Partials 42 42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Requested by Nathaniel · project thread
Follow-up to #4182.
Motivation
Before:
yarn check:typeperfmeasured instantiations with the TypeScript 6 JS API (require('typescript')resolves to@typescript/typescript6), while the repo builds and type-checks with TypeScript 7 (@typescript/native).After: it measures with the same TypeScript 7
tscthe repo builds with, so the budget tracks the compiler users and CI actually run.Solution
check.mjsspawns the repo'stsc(the bin yarn puts on PATH) with--extendedDiagnostics --pretty falseper fixture and reads theInstantiations:andTotal time:lines. A non-zero exit fails the fixture and prints the first 10 errors; output with no instantiation count fails too. The version comes fromtsc --version.budget.jsonis a new TypeScript 7.0.2 baseline, re-recorded with--update. These numbers are not comparable to the old TS 6 ones. TS 7 counts are within 4% of TS 6 for every fixture exceptschemas(99,251 → 109,095, +9.9%). That's a compiler difference, not a change to our types: master's types are unchanged in this PR.--checkers 1/--singleThreaded, since each fixture is one source file).Validated:
yarn check:typeperfpasses; injecting a type error into a fixture fails withtsc exited with 1, 1 type errorsand the error line; deleting a fixture's budget fails withhas no budget.Open questions
Running fixtures in parallel would cut the check to about 5–6s on 4 cores without changing counts, but makes the printed times noisier. I left it sequential for now.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QFo5AAtZp18HcwiXBqBDEZ
Generated by Claude Code
Note
Low Risk
Changes only the typeperf CI script and recorded budgets; library types and runtime behavior are untouched.
Overview
yarn check:typeperfnow measures instantiation counts with the same TypeScript 7tscthe repo builds with (@typescript/native), instead of the TypeScript 6 programmatic API.check.mjsspawnstscper fixture with--extendedDiagnostics, parsesInstantiationsandTotal timefrom stdout, and records the compiler version fromtsc --version. Non-zero exits and missing instantiation output fail the check; Windows still uses a shell only on win32 and passes a relative tsconfig path.budget.jsonis re-recorded for TypeScript 7.0.2 — counts are not comparable to the old TS 6 baseline. The README notes that compiler upgrades require--updatewhen counts shift.Reviewed by Cursor Bugbot for commit 2ee0f08. Bugbot is set up for automated code reviews on this repo. Configure here.