Skip to content

build: Upgrade TypeScript to 7.0.2 - #13743

Draft
MounirDhahri wants to merge 3 commits into
mainfrom
claude/typescript-7-upgrade-cmpnvk
Draft

build: Upgrade TypeScript to 7.0.2#13743
MounirDhahri wants to merge 3 commits into
mainfrom
claude/typescript-7-upgrade-cmpnvk

Conversation

@MounirDhahri

@MounirDhahri MounirDhahri commented Jul 9, 2026

Copy link
Copy Markdown
Member

This PR resolves []

Description

Upgrades TypeScript from 5.9.2 to 7.0.2 — the new native (Go-based) compiler — keeping the same checking semantics.

Warning

Draft — blocked on typescript-eslint. @typescript-eslint 5.57.0 crashes on load against typescript@7 (TypeError: Cannot read properties of undefined (reading 'Undefined')), which breaks yarn lint (local lint-staged / pre-commit and editors). No typescript-eslint release supports TS 7 yet — the latest (8.63.0) pins typescript >=4.8.4 <6.1.0. Merging is gated on upstream TS 7 support or an ESLint stack rework. Type-checking itself is fully working.

Type-check performance on the same machine:

TS 5.9.2 TS 7.0.2 Speedup
Cold yarn tsc 38.9s 7.3s 5.3×
Incremental (warm) 12.0s 2.6s 4.6×

Error counts identical before/after (the one pre-existing error in both runs is the missing EchoNew.json fixture in the benchmark sandbox, which couldn't reach echo.artsy.net — unrelated to TS).

Config migration (equivalence-preserving): baseUrl was removed in TS 7 → the equivalent paths: { "*": ["./src/*"] }, so app/... imports keep resolving.

Yarn bump 4.10.3 → 4.17.1 (same release force uses): Yarn 4.10.3's builtin compat/typescript patch crashes on TS 7's package layout (ENOENT: lib/_tsc.js), making yarn install impossible with typescript@7.

Code fix: scripts/check-flags/check-flags.js used CommonJS top-level this (alias of module.exports), which TS 7 now flags under @ts-check; replaced with the explicit module.exports equivalent — script output verified byte-identical.

CI fixes:

  • .secrets.baseline regenerated for the new .yarn/releases/yarn-4.17.1.cjs (bundled-release entropy strings, not real secrets) — fixes the detect-secrets job.
  • Danger transpiles dangerfile.ts via the legacy ts.transpileModule API, gone in TS 7 — the check-code job now preloads scripts/typescript5-shim.js (NODE_OPTIONS) so require("typescript") resolves to a TS 5 compiler API (typescript5 alias package) inside the danger process only. Deletable once danger supports TS 7. ✅ green as of 7d155ec.
  • build-test-app-android still fails and needs a look at the CircleCI log (not reachable from the working sandbox). Ruled out locally under TS 7: react-native config, the full Metro android release bundle, and expo-modules-autolinking all succeed — and iOS, which shares that JS tooling, is green. Suspect the native/gradle stage, or simply that this PR's yarn.lock/package.json changes invalidate the build-success.log cache so this job does a full native build that main normally skips via cache.

Heads-up: [email protected] was published 2026-07-08. Installs that re-resolve it need YARN_NPM_MINIMAL_AGE_GATE=0 until it clears the 1-day npmMinimalAgeGate; immutable CI installs from the committed lockfile are unaffected.

PR Checklist

  • I have tested my changes on the following platforms:
    • Android.
    • iOS.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos at least on Android, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Dev changes

  • Upgrade TypeScript to 7.0.2 (native compiler) — ~5× faster type-checks

🤖 Generated with Claude Code

https://claude.ai/code/session_01GDuwNGgkcESgEa8E1ADWJi

claude added 3 commits July 9, 2026 11:10
Upgrades to the native (Go-based) TypeScript 7 compiler. Cold type-check
drops from ~39s to ~7s, incremental from ~12s to ~2.6s.

Config migration (equivalence-preserving, required by TS 7):
- baseUrl was removed in TS 7 -> the equivalent
  paths: { "*": ["./src/*"] } so 'app/...' imports keep resolving

Yarn 4.10.3's builtin compat/typescript patch crashes on the TS 7 package
layout, so the bundled Yarn is bumped to 4.17.1 (same release force uses).

Code fix: scripts/check-flags/check-flags.js used CommonJS top-level
'this' (alias of module.exports), which TS 7 now flags under @ts-check;
replaced with the explicit module.exports equivalent (script output
verified unchanged).

KNOWN BLOCKER before merging: @typescript-eslint (5.57.0) crashes on load
against typescript@7 - 'yarn lint' fails repo-wide. No typescript-eslint
release supports TS 7 yet (latest 8.63.0 pins typescript <6.1.0), so
adopting TS 7 here is gated on upstream support or an ESLint stack rework.

Note: typescript 7.0.2 was published 2026-07-08; installs that re-resolve
it before it clears the 1-day npmMinimalAgeGate need
YARN_NPM_MINIMAL_AGE_GATE=0 (immutable CI installs from the lockfile are
unaffected).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GDuwNGgkcESgEa8E1ADWJi
- .secrets.baseline still allowlisted the removed .yarn/releases/yarn-4.10.3.cjs;
  regenerate entries for yarn-4.17.1.cjs (bundled-release entropy strings, not
  real secrets) so the detect-secrets CI job passes
- Danger transpiles dangerfile.ts via the legacy ts.transpileModule API, which
  typescript@7 no longer exposes; set DANGER_DISABLE_TSC=true so danger uses
  @babel/plugin-transform-typescript instead (verified the dangerfile
  transpiles cleanly through the babel path)

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GDuwNGgkcESgEa8E1ADWJi
DANGER_DISABLE_TSC pushed danger onto its babel transpiler, which hits a
babel-plugin-relay reentrancy cycle when the dangerfile's imports pull in
relay.config.js. Keep danger on its TypeScript path instead: preload
scripts/typescript5-shim.js so require("typescript") resolves to a TS 5
compiler API (typescript5 alias package) inside the danger process only.
Verified locally that dangerfile.ts transpiles and evaluates through this
path.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GDuwNGgkcESgEa8E1ADWJi
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