Repository navigation
Description
Proposal: https://expensify.slack.com/archives/C08CZDJFJ77/p1771923976005829
Proposal: Early adoption of tsgo for faster type checking during development
Background
Our codebase uses tsc (TypeScript 5.x) for type checking, invoked via npm run typecheck. Developers run it locally before pushing, CI runs it on every PR, and AI coding agents (Claude Code, Cursor, Copilot) run it after every code change to verify correctness.
Microsoft has been developing a native port of the TypeScript compiler written in Go, known as tsgo (to be released as TypeScript 7). It is available on npm as @typescript/native-preview and promises ~10x faster type checking. The project is still in active development and may not yet be 100% stable, but its authors state that its type checking produces the same errors, locations, and messages as TypeScript 6.0.
tsgo is also stricter than tsc — during our initial integration it caught genuine bugs that tsc silently accepted: duplicate keys in type mappings and missing null checks.
Problem
When a developer or AI agent makes a type-level change, the tsc type check significantly slows down the development iteration loop, which reduces development velocity and discourages running type checks before pushing.
Solution
Adopt tsgo incrementally for development-only type checking in three stages, keeping tsc as the production CI gate until tsgo reaches full stability.
Stage 1: Local npm command
Draft PR: #83228
Add @typescript/native-preview as a dev dependency and configure a dedicated tsconfig.tsgo.json that mirrors the main tsconfig.json (with adjustments for tsgo compatibility, such as removing baseUrl which TypeScript 7 has deprecated). Fix existing bugs detected by tsgo — duplicate keys in type mappings, incorrect field assignment, missing null checks, and incorrect module import paths.
Developers can run npm run typecheck-tsgo locally for a fast type-check pass during development. The existing npm run typecheck (tsc) remains unchanged and continues to be the source of truth.
Expensify App benchmark:
Full check: 116.3s → 15.7s (-86%)
Incremental (no changes): 9.2s → 1.6s (-83%)
Memory usage: 6,428MB → 5,463MB (-15%)
Stage 2: CLAUDE.md integration for AI agents
Add guidance to CLAUDE.md so AI agents prefer npm run typecheck-tsgo for iterative type checking. Agents run type checks after every change — a ~10x speedup directly reduces task completion time and cost. Since tsgo is stricter, code that passes it is likely to also pass tsc.
- For iterative development, prefer
npm run typecheck-tsgo(faster, stricter) thennpm run typecheck.
Stage 3: GitHub Actions integration
Add typecheck-tsgo as a blocking CI check on PRs, alongside existing tsc. Both checks are required — tsc remains necessary before full migration to ensure correct application builds, while tsgo enforces stricter type safety to simplify development and keep main clean. An additional benefit is that once tsgo reaches production readiness, the codebase will already be fully compatible and ready for migration.
Activity
roryabraham commentedon Feb 26, 2026
Step 1 complete
dariusz-biela commentedon Feb 26, 2026
@roryabraham
I suggest waiting a week and seeing if the developers catch any problems with
tsgo.And if not, then integrate it with the rules for AI (Claude.md).
What do you think about this?
DylanDylann commentedon Feb 27, 2026
@roryabraham Could you assign me to this issue so I can continue working on the next PRs?
roryabraham commentedon Feb 27, 2026
Fine with me 👍🏼
Update CLAUDE.md to prefer typecheck-tsgo for AI agent development wo…
34 remaining items
melvin-bot commentedon Apr 30, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon May 1, 2026
Is this due payment? I see multiple stages in the OP
roryabraham commentedon May 1, 2026
$250 due to @DylanDylann for review of #87771, then let's close this out. When stable TS 7 is released, we can handle the upgrade in a separate issue
mallenexpensify commentedon May 2, 2026
Payment Summary
Contributor+: @DylanDylann due $250 via NewDot
quinthar commentedon May 6, 2026
Approved $250 to @DylanDylann
[-][Due for payment 2026-04-30] Set up tsgo for development[/-][+][Due for payment 2026-06-09] [Due for payment 2026-04-30] Set up tsgo for development[/+]melvin-bot commentedon Jun 2, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jun 2, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.90-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-06-09. 🎊
For reference, here are some details about the assignees on this issue: