Skip to content

[Due for payment 2026-06-09] [Due for payment 2026-04-30] Set up tsgo for development #83349

Closed

Description

@roryabraham

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) then npm 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.

Issue OwnerCurrent Issue Owner: @DylanDylann

Activity

  1. roryabraham commented on Feb 26, 2026

    @roryabraham
    ContributorAuthor

    Step 1 complete

  2. dariusz-biela commented on Feb 26, 2026

    @dariusz-biela
    Contributor

    @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?

  3. DylanDylann commented on Feb 27, 2026

    @DylanDylann
    Contributor

    @roryabraham Could you assign me to this issue so I can continue working on the next PRs?

  4. roryabraham commented on Feb 27, 2026

    @roryabraham
    ContributorAuthor

    I suggest waiting a week and seeing if the developers catch any problems with tsgo.

    Fine with me 👍🏼

  5. 34 remaining items

  6. melvin-bot commented on Apr 30, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  7. mallenexpensify commented on May 1, 2026

    @mallenexpensify
    Contributor

    Is this due payment? I see multiple stages in the OP

  8. roryabraham commented on May 1, 2026

    @roryabraham
    ContributorAuthor

    $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

  9. mallenexpensify commented on May 2, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @DylanDylann due $250 via NewDot

  10. quinthar commented on May 6, 2026

    @quinthar
    Contributor

    Approved $250 to @DylanDylann

  11. changed the title [-][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[/+] on Jun 2, 2026
  12. melvin-bot commented on Jun 2, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  13. melvin-bot commented on Jun 2, 2026

    @melvin-bot

    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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2ImprovementItem broken or needs improvement.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions