Skip to content

build(solidity): raise TypeScript to 6.0.3 in both packages - #4208

Open
mswilkison wants to merge 1 commit into
chore/solidity-typecheck-gatefrom
chore/solidity-typescript-6
Open

build(solidity): raise TypeScript to 6.0.3 in both packages#4208
mswilkison wants to merge 1 commit into
chore/solidity-typecheck-gatefrom
chore/solidity-typescript-6

Conversation

@mswilkison

Copy link
Copy Markdown
Contributor

Stacked on #4207.

6.0.3 is the last TypeScript release with a JavaScript API. I checked what 7.x actually ships:

node_modules/typescript/lib/  →  getExePath.js  tsc.js  version.cjs
require("typescript").transpileModule       → undefined
require("typescript").createProgram         → undefined
require("typescript").createLanguageService → undefined

There is no lib/typescript.js — the 7.x package is a launcher for the Go binary. ts-node (which hardhat 2 uses to run hardhat.config.ts and the tests), @typescript-eslint, typechain and prettier's TS parser all drive that API, so installing 7 today would break the build, the linter and codegen at once. 6.x is where this stops until those ship tsgo support.

Three defaults changed, all pinned back

This is a version bump, not a tightening, so each new default is pinned to what the packages already do:

Default Effect if left alone Pinned to
strict now on strict debt in both packages "strict": false (random-beacon keeps its existing noImplicitAny)
@types/* no longer auto-included mocha/chai globals vanish — 1 732 diagnostics in ecdsa alone "types": [...] naming the packages that contribute globals
rootDir required for multi-directory projects hardhat refuses to start "rootDir": "."

The rootDir one is the reason to run more than the type checker: tsc --noEmit stays perfectly green while hardhat test dies with TS5011.

Turning strict on is real work and belongs in its own PR.

The ES5 export bundle is on borrowed time

Both packages publish an export/ bundle built through tsconfig.export.json at target: es5. In TypeScript 6, both that target (TS5107) and downlevelIteration (TS5101) are deprecated, and both are removed in TypeScript 7.

They are silenced here with "ignoreDeprecations": "6.0" rather than removed, because at target: es5 downlevelIteration genuinely changes emit for for…of over non-array iterables, and that bundle is consumed by downstream packages. In ecdsa this also matters for prepare, which runs the same build on install — so getting it wrong breaks yarn install, not just publishing.

Raising the export target off ES5 is a prerequisite for TypeScript 7 and is tracked separately.

Verification

Both packages, on 6.0.3:

random-beacon ecdsa
tsc --noEmit 0 errors 0 errors
tsc -p tsconfig.export.json builds builds
yarn lint 0 errors 0 errors
yarn test 955 passing / 0 failing 673 passing / 0 failing

Lockfile churn is 18 lines per package, all typescript.

6.0.3 is the last release with a JavaScript API. TypeScript 7 ships only
a launcher for the Go binary -- no `lib/typescript.js`, and
`transpileModule`, `createProgram` and `createLanguageService` are all
undefined -- so ts-node, @typescript-eslint and typechain cannot drive
it. 6.x is the end of the line until those ship tsgo support.

Three defaults changed, pinned back in both packages so the bump is
behaviour-preserving rather than a silent tightening:

- `strict` now defaults on. Pinned off. random-beacon keeps the
  `noImplicitAny` it had already opted into.
- `@types/*` are no longer all included automatically, which quietly
  removed the mocha and chai globals -- 1 732 diagnostics in ecdsa alone.
  `types` now names the packages that actually contribute globals.
- `rootDir` must be stated once a project spans several top-level
  directories. `--noEmit` does not care; ts-node's emit path does, so
  hardhat would not start without it.

Both packages also publish an `export/` bundle built at `target: es5`,
and in TypeScript 6 both that target and `downlevelIteration` are
deprecated. Silencing them via `ignoreDeprecations` keeps `prepack`
working -- and in ecdsa, `prepare`, which runs the same build on install.
Raising the export target is required before TypeScript 7 and is its own
change; guessing the options are inert would alter an artifact that
downstream packages consume.

Verified on 6.0.3, both packages: `tsc --noEmit` 0 errors,
`tsc -p tsconfig.export.json` builds, `yarn lint` 0 errors.
random-beacon 955 passing / 0 failing; ecdsa 673 passing / 0 failing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 16ad78b8-5025-4e50-a81d-7382d677d866

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/solidity-typescript-6

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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