chore: TypeScript 7 beta build:ts7 harness (benchmarking)#8657
chore: TypeScript 7 beta build:ts7 harness (benchmarking)#8657paulbalaji wants to merge 2 commits intomainfrom
Conversation
Adds `@typescript/native-preview` (TS 7 beta, `tsgo`) as a root devDep and mirrors each package's `build` script as `build:ts7`, swapping `tsc` for `tsgo`. Root `pnpm build:ts7` runs the parallel compile via turbo so the two compilers can be benchmarked against the same tree. Not a replacement for TS 6 — regular `pnpm build` continues to use `tsc` from the `typescript` catalog entry.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8657 +/- ##
=======================================
Coverage 79.33% 79.33%
=======================================
Files 143 143
Lines 4278 4278
Branches 436 436
=======================================
Hits 3394 3394
Misses 855 855
Partials 29 29
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…uild:ts7
- Add `build:ts7` to `@hyperlane-xyz/core` and `@hyperlane-xyz/starknet-core`
(both invoke tsc in their build chain).
- Override `build:tron` in solidity/turbo.json to depend on `deps:soldeer`
directly rather than `build`. Prevents concurrent `core#build` and
`core#build:ts7` invocations (which race on hardhat-esm compile output)
when tron-sdk is in the graph.
- Mirror tron-sdk's `build` turbo override for `build:ts7` so it pulls in
`core#build:tron` for tron ABI artifacts.
- Rewrite three Solana `new Transaction({...})` call sites that used
`@ts-expect-error` / `@ts-ignore` to pass `blockhash` + `recentBlockhash`
together. tsc 6 and tsgo 7 apply the directive at different scopes, so
neither position satisfies both. Using an intermediate variable bypasses
the excess-property check in both compilers without casts.
Node Services Docker Image Built Successfully
Full image paths |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4f476d1. Configure here.
| "scripts": { | ||
| "hyperlane": "node ./dist/cli.js", | ||
| "build": "pnpm version:update && NODE_OPTIONS='--max-old-space-size=4096' tsc", | ||
| "build:ts7": "pnpm version:update && NODE_OPTIONS='--max-old-space-size=4096' tsgo", |
There was a problem hiding this comment.
NODE_OPTIONS is meaningless for Go-based tsgo binary
Low Severity
The build:ts7 script sets NODE_OPTIONS='--max-old-space-size=4096' before invoking tsgo, which is a native Go binary (not a Node.js process). This environment variable is silently ignored by Go. It was mechanically carried over from the build script where it's needed for tsc (a Node.js process). While harmless at runtime, it's misleading — a future reader may assume tsgo requires 4 GB of heap, or try to tune this knob expecting it to affect the Go compiler.
Reviewed by Cursor Bugbot for commit 4f476d1. Configure here.
| "cache-tron/**", | ||
| "artifacts-tron/**", | ||
| "dist/tron/typechain/**" | ||
| ] |
There was a problem hiding this comment.
New build:tron override silently changes existing build dependency graph
Medium Severity
Adding build:tron to solidity/turbo.json with "dependsOn": ["deps:soldeer"] overrides the root turbo.json definition where build:tron depends on ["build"]. This decouples build:tron from the regular build for the solidity package, allowing them to run in parallel during pnpm build. Previously they ran sequentially. The comment in build-tron.sh line 9 explicitly documents the old invariant: (build:tron depends on build, which depends on deps:soldeer). This behavioral change to the existing build pipeline is unrelated to the TS7 benchmarking goal.
Reviewed by Cursor Bugbot for commit 4f476d1. Configure here.


Summary
@typescript/native-preview@7.0.0-dev.20260421.2(TS 7 beta, CLI =tsgo) as a root devDep + catalog entry.buildscript asbuild:ts7withtscswapped fortsgo(27 packages acrosstypescript/,solidity/,starknet/).build:ts7turbo task and rootpnpm build:ts7so both compilers run against the same tree.pnpm buildstill usestscfrom the existingtypescript: 6.0.2catalog entry.Draft PR — opened to compare cold build time between the existing
tscandtsgo.Benchmark results (local, macOS arm64)
Measured with
pnpm -w turbo run clean && /usr/bin/time -p pnpm <task> --forceafter both compilers were fully installed. Each path runs all 29 workspace build tasks (TS + hardhat compile + typechain + prisma + tailwindcss + forge tron build).pnpm build(tsc 6.0.2)pnpm build:ts7(tsgo 7.0.0-dev)pnpm build(turbo cache hit)pnpm build:ts7(turbo cache hit)tsgo is ~30% faster end-to-end on the full cold monorepo build (130 s → 90 s wall, ~40 s absolute). User-CPU reduction is similar (~31 %). Warm numbers are cache-dominated and uninformative.
The actual per-package
tsc → tsgospeedup is larger than 30 % — the cold build wall time includes non-TS work (forge/tron compile, hardhat/typechain forcore+helloworld, prisma codegen, tailwindcss) that runs identically in both paths.Why native-preview vs. a
typescript@7-betabumpPer the TS 7 beta announcement, TS 7 beta ships under
@typescript/native-previewwith thetsgobinary; the stable release will eventually publish undertypescript. No drop-in replacement exists today. Keeping both installed side-by-side is the cleanest way to benchmark.Build fixes required to reach parity
Getting
build:ts7green on all 29 tasks required three code changes. These are real behavioral differences betweentsc 6.0.2andtsgo 7.0.0-dev.20260421.2, not tooling issues:@ts-expect-error/@ts-ignorescope differs.tsc 6applies the directive to the full next statement;tsgo 7applies it only to the immediate next line. For a multi-linenew Transaction({ ... })call where a single property (blockhash) violates the ctor type, no single directive position satisfies both. Fixed by extracting the object literal into an intermediate variable, which bypasses excess-property checks in both compilers without casts. Affects 3 call sites (sdk/SealevelCrossCollateralAdapter.ts,sdk/SealevelTokenAdapter.ts,helloworld/sealevelAdapter.ts).core#build:trondependency restructuring. The existingbuild:tron → buildturbo edge causedcore#buildandcore#build:ts7to run concurrently in the TS 7 path, racing on hardhat-esm / typechain output (MalformedAbiError: Not a json).solidity/turbo.jsonnow overridesbuild:tronto depend ondeps:soldeerdirectly;build-tron.shonly needs soldeer, not the tsc output.build:ts7task wiring.tron-sdk/turbo.jsonmirrors its existingbuildoverride to depend on@hyperlane-xyz/core#build:tron, andsolidity/turbo.jsondeclares thebuild:ts7task.Notes
pnpm minimumReleaseAge(7 days) blocks TS 7 dev builds, so@typescript/native-previewand@typescript/native-preview-*(platform binaries) are added tominimumReleaseAgeExclude.target: es5, nobaseUrl, no legacymodule: amd/umd/systemjs/none(the other TS 7 breaking changes).widgetssplitsbuild:ts7-only+build:cssto mirror its existingbuild:ts+build:csspattern.Test plan
pnpm installsucceeds on a clean checkoutpnpm exec tsgo --versionreports 7.0.0-devpnpm build(TS 6, cold): 29/29 tasks succeed, 130 s wallpnpm build:ts7(TS 7, cold): 29/29 tasks succeed, 90 s wall