Skip to content

build(js): upgrade TypeScript to 6.0 (both clients)#346

Merged
joncinque merged 1 commit into
solana-program:mainfrom
clankmaxxing-clod:build/js-upgrade-typescript-6
Jun 30, 2026
Merged

build(js): upgrade TypeScript to 6.0 (both clients)#346
joncinque merged 1 commit into
solana-program:mainfrom
clankmaxxing-clod:build/js-upgrade-typescript-6

Conversation

@clankmaxxing-clod

Copy link
Copy Markdown
Contributor

Upgrades both JS clients in this repo to typescript@^6.0.3. The two clients use different build systems, so the required changes differ — each was verified by building under TS6, not by copying a template.

clients/js (modern, tsup + vitest)

  • Add "rootDir": "./src" to tsconfig.declarations.json.
    • Under TS6, the tsc declaration-emit step fails with TS5011 without it. No-op layout change otherwise; the client already uses moduleResolution: "bundler".

clients/js-legacy (tsc --build, mocha)

  • tsconfig.base.json: "ignoreDeprecations": "6.0", "lib": ["ES2020", "DOM"], "types": ["node"]
  • tsconfig.cjs.json / tsconfig.esm.json: "rootDir": "./src"
  • tsconfig.json: "types": ["node", "mocha"]

Each maps to a real TS6 error seen on an unmodified build:

  • TS5107node10/"Node" resolution deprecated → ignoreDeprecations.
  • TS2583BigInt not found (the cjs project targets ES2016 and the source uses BigInt) → lib: ["ES2020", "DOM"].
  • TS2591Buffer/http/https globals unresolved (@types/node under the classic resolver) → types: ["node"].
  • TS5011cjs/esm composite projects need an explicit rootDir.
  • The base types narrowing then hides mocha's globals from the test build → tsconfig.json re-adds ["node", "mocha"].

Note: unlike the token-group legacy client, this one genuinely needs the lib override because its source uses BigInt.

Verification (local, typescript@6.0.3)

  • clients/js: ✅ pnpm build (tsup + tsc declarations), ✅ pnpm lint
  • clients/js-legacy: ✅ pnpm build (tsc --build, cjs/esm/types emit), ✅ pnpm lint, ✅ pnpm test:exports. The mocha integration tests (basic/longRecord) connect to a local validator (127.0.0.1:8899) and weren't run here; they compiled and ran (failing only on the missing RPC), so the types fix is confirmed — CI will run them against a validator.

🤖 Generated with Claude Code

Upgrade both JS clients to typescript@^6.0.3.

clients/js (modern, tsup):
- Add "rootDir": "./src" to tsconfig.declarations.json (TS6 requires an
  explicit rootDir for declaration emit; TS5011).

clients/js-legacy (tsc --build):
- tsconfig.base.json: add "ignoreDeprecations": "6.0" (node10/"Node"
  resolution is deprecated, TS5107), "lib": ["ES2020", "DOM"] (the cjs
  project targets ES2016 and the source uses BigInt, TS2583), and
  "types": ["node"] (so Buffer/http/https resolve, TS2591).
- tsconfig.cjs.json / tsconfig.esm.json: add "rootDir": "./src" (TS5011).
- tsconfig.json: "types": ["node", "mocha"] so the test build sees
  mocha's globals after the base "types" narrowing.

Each change corresponds to an actual TS6 compiler error observed when
building unmodified; no extra options were added.

Verified locally with typescript@6.0.3:
- clients/js: `pnpm build` + `pnpm lint` pass.
- clients/js-legacy: `pnpm build`, `pnpm lint`, and `pnpm test:exports`
  pass. The mocha integration tests (basic/longRecord) require a local
  validator and were not run here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joncinque joncinque merged commit 500249d into solana-program:main Jun 30, 2026
22 checks passed
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