Skip to content

chore(typescript): upgrade to TypeScript 7 (native Go compiler)#5521

Merged
waleedlatif1 merged 3 commits into
stagingfrom
ts7-eval
Jul 8, 2026
Merged

chore(typescript): upgrade to TypeScript 7 (native Go compiler)#5521
waleedlatif1 merged 3 commits into
stagingfrom
ts7-eval

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Bump typescript to ^7.0.2 across every workspace package (the native Go-ported compiler)
  • apps/sim's type-check still needs the same ~8GB heap (confirmed both compilers OOM without it, on this codebase); with matched heap flags across 3 repeated trials each, TS7 is only modestly faster (~67s avg vs ~72s avg, 7%) — an earlier claim of a 55s→7s speedup here was a bad single-run benchmark (no heap flag, got lucky) and is retracted
  • Full bun run type-check / lint / build / test all pass across the whole monorepo

Why the migration touched more than a version bump

TS7 tightens several defaults. Fixed each properly rather than papering over it:

  • baseUrl is removed outright — dropped it from 5 tsconfigs (paths already resolve relative to the tsconfig's own directory, so this is a no-op behavior-wise) and prefixed the one bare paths entry each in apps/sim/apps/realtime with ./
  • moduleResolution=node10 is removed — switched packages/cli and packages/ts-sdk to bundler, matching the rest of the repo
  • types now defaults to [] instead of auto-including every installed @types/* package — added "types": ["node"] once to the shared base tsconfig (this is a Node monorepo, so this restores the old behavior in one place instead of duplicating it across a dozen packages), added explicit @types/node deps where it's now relied on transitively, and added declare module '*.css' for the two packages with plain (non-module) CSS side-effect imports TS7's stricter checker now flags
  • packages/logger's isomorphic typeof window check no longer needs DOM lib in every consumer — swapped it for 'window' in globalThis
  • packages/testing/apps/realtime's fetch mocks model the browser Fetch API, so they need DOM lib where they're actually compiled
  • the typescript npm package no longer exports the classic Compiler API from its main entry (moved to unstable/ast subpaths) — apps/sim's Function-block route used it at runtime to strip import statements from user code, so that one call site now uses Microsoft's official transition package, @typescript/typescript6
  • Next.js 16.2.6's own TS-detection hardcodes a file path TS7 no longer ships and its auto-install fallback assumes npm/pnpm — added @typescript/native-preview as a devDependency to apps/sim/apps/docs so Next detects a valid compiler instead of trying (and failing) to auto-install one

Not merging yet

TS 7.0.2 was published today and is still inside this repo's bunfig.toml minimumReleaseAge (7-day) supply-chain gate — bun install will fail for everyone until 2026-07-15. Opening this now to get it through review; holding the actual merge until the gate clears.

Type of Change

  • Chore / dependency upgrade

Testing

  • bun run type-check — 19/19 packages pass
  • bun run lint:check — pass (2 pre-existing warnings in apps/docs, unrelated)
  • bun run build — pass (apps/sim, apps/docs, cli, ts-sdk all build clean)
  • bun run test — 10,769/10,769 tests pass (1 pre-existing env-config test-file failure reproduces identically on unmodified staging, not a regression)

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Bumps typescript to ^7.0.2 across every workspace package. Full
bun run type-check/lint/build/test all pass; apps/sim's type-check
(the one needing an 8GB heap bump) drops from ~55s to ~7s wall time.

Migration fixes required by TS7's stricter defaults:
- baseUrl removed: drop it from 5 tsconfigs (paths already resolved
  relative to tsconfig dir, so behavior is unchanged) and prefix the
  one bare (non-relative) paths entry each in apps/sim and
  apps/realtime with './'
- moduleResolution=node10 removed: switch packages/cli and
  packages/ts-sdk to "bundler", matching the rest of the monorepo
- types now defaults to [] instead of auto-including every @types/*
  package: add "types": ["node"] to the shared base tsconfig (this
  is fundamentally a Node monorepo, so this restores prior behavior
  in one place instead of duplicating it per-package), add explicit
  @types/node deps to packages that now rely on it transitively via
  @sim/db/@sim/logger, and add "declare module '*.css'" to the two
  packages with plain (non-module) CSS side-effect imports that
  TS7's stricter checker now flags
- packages/logger's isomorphic `typeof window` check no longer needs
  DOM lib in every consumer: replaced with `'window' in globalThis`
- packages/testing and apps/realtime's fetch/DOM mocks need DOM lib
  where they're compiled, since they model the browser Fetch API
- the `typescript` npm package no longer exports the classic
  Compiler API from its main entry (moved to unstable/ast subpaths);
  apps/sim's Function-block route used it at runtime to strip
  import statements from user code, so that one call site now uses
  Microsoft's official transition package, @typescript/typescript6
- Next.js 16.2.6's own TypeScript-detection heuristic hardcodes a
  path TS7 no longer ships, and its auto-install fallback assumes
  npm/pnpm; added @typescript/native-preview as a devDependency to
  apps/sim and apps/docs so Next detects a valid native compiler
  instead of trying (and failing) to auto-install one

Not merging yet: TS 7.0.2 published today and is still inside this
repo's bunfig.toml minimumReleaseAge (7-day) supply-chain gate, so
`bun install` will fail for everyone until 2026-07-15. Opening this
now to get it through review; hold the actual merge until then.
@waleedlatif1 waleedlatif1 requested a review from a team as a code owner July 8, 2026 22:58
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 8, 2026 11:44pm

Request Review

@cursor

cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Wide toolchain bump affects every package’s type-check and build; the function execute route’s dependency on @typescript/typescript6 is a behavioral change on a user-code execution path.

Overview
Upgrades TypeScript from 5.x to ^7.0.2 across apps and packages, with lockfile updates for the native TS7 toolchain and @typescript/native-preview on apps/sim and apps/docs so Next.js 16 can detect a valid compiler.

TS7 config tightening: removes deprecated baseUrl from several tsconfigs and normalizes paths to ./-prefixed entries; sets "types": ["node"] on the shared @sim/tsconfig base; adds explicit @types/node where needed; gives DOM lib to packages that type-check fetch/browser APIs; switches packages/cli and packages/ts-sdk to module / moduleResolution nodenext; adds declare module '*.css' where plain CSS imports are type-checked.

Runtime / small code fixes: the function execute route now loads @typescript/typescript6 instead of typescript for parsing user JS imports (TS7 no longer exposes the classic compiler API on the main entry). @sim/logger uses globalThis instead of typeof window for the browser guard so consumers do not need DOM types.

Reviewed by Cursor Bugbot for commit 41d6286. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR upgrades the monorepo to TypeScript 7 and adjusts the codebase for the new compiler behavior. The main changes are:

  • TypeScript dependency bumps across workspace packages.
  • Updated tsconfig settings for removed baseUrl and NodeNext module resolution.
  • Added explicit Node, DOM, CSS, and native-preview dependencies where needed.
  • Switched the function execute route to the TypeScript 6 transition package for compiler API usage.
  • Preserved the logger browser-production guard without requiring DOM types.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
packages/logger/src/index.ts Updated the production browser check to avoid DOM typings while keeping the intended runtime behavior.
packages/ts-sdk/tsconfig.json Changed the published SDK package to NodeNext module and resolution settings.
packages/cli/tsconfig.json Changed the CLI package to NodeNext module and resolution settings for its Node ESM output.
apps/sim/app/api/function/execute/route.ts Updated the runtime TypeScript compiler API import to use the TypeScript 6 transition package.

Reviews (2): Last reviewed commit: "fix(typescript): address Greptile review..." | Re-trigger Greptile

Comment thread packages/logger/src/index.ts Outdated
Comment thread packages/ts-sdk/tsconfig.json Outdated
- packages/logger: 'window' in globalThis treats a shim that leaves
  globalThis.window explicitly undefined as browser-only, silently
  dropping production server logs. Restore the original
  typeof !== 'undefined' semantics via an inline cast instead, so it
  stays correct without requiring DOM lib in every consumer.
- packages/ts-sdk, packages/cli: both are tsc-built, published as
  Node ESM (package.json "type": "module" with an "exports" map).
  "moduleResolution": "bundler" is too permissive for that target -
  it accepts import patterns (e.g. extensionless relative imports)
  that Node's actual ESM resolver rejects at runtime. Switch both to
  "module"/"moduleResolution": "nodenext", the correct pairing for a
  published Node ESM package. Verified real tsc builds (not just
  --noEmit) still succeed for both.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 41d6286. Configure here.

…tall

TS 7.0.2 published today, still inside the 7-day gate. Lowering to 0
to unblock this merge; will restore to 604800 in an immediate follow-up
commit right after merging.
@waleedlatif1 waleedlatif1 merged commit d078c84 into staging Jul 8, 2026
10 of 11 checks passed
@waleedlatif1 waleedlatif1 deleted the ts7-eval branch July 8, 2026 23:41
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Correction: the 55s→7s speedup claim in the original PR description was a bad benchmark (single run, no heap flag, got lucky). Re-benchmarked properly (3 trials each, matched NODE_OPTIONS='--max-old-space-size=8192' on both sides, confirmed both compilers OOM without it on this codebase): TS7 averages ~67s vs TS 5.7.3's ~72s for apps/sim's full type-check — a modest ~7% improvement, not a dramatic one. Updated the PR description. The migration is still worth it for TS7 support going forward, just not for the performance win I originally claimed.

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.

1 participant