chore!: bump TypeScript target and lib to ES2022 - #333
Open
cryptodev-2s wants to merge 1 commit into
Open
Conversation
cryptodev-2s
added this pull request to stack #331
September 9, 2026 20:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Top of stack #331, on #325. Mirrors MetaMask/core#10019, the last of core's foundational chain.
targetES2020ES2022lib["ES2020", "DOM"]["ES2022", "DOM"]Correctly last in the order: raising the emit target is only defensible once the Node floor guarantees the runtime supports it, which #328 established.
It is not cosmetic
wrapErrorsetscausebehind two@ts-ignorecomments, with this note in the source:Error.causeis ES2022, so both suppressions are now obsolete and are removed. The types are genuine rather than ignored.The evidence came from enabling test type checking: with
lib: ES2020atscpass over the tests reports 11 errors, nearly allProperty 'cause' does not exist. Withlib: ES2022it reports zero. That is why the type checking PR stacks on top of this one rather than below it.Verification
Build, tests, tsd, eslint and lint all pass.
Note
Medium Risk
Semver-breaking compiler target change can affect downstream bundlers or runtimes below ES2022, though the project already requires Node 22+/24.
Overview
Breaking: Raises TypeScript
compilerOptions.targetandlibfrom ES2020 to ES2022 (DOM lib unchanged), so emitted JS and type definitions align with MetaMask core. The unreleased changelog notes that build output may use ES2022 syntax; callers on the package’s supported Node range should be fine.With ES2022 in
lib,Error’s optionalcauseis part of the standard typings. InwrapError, the@ts-ignoresuppressions and comments that explained the old ES2020 limitation are removed—new Error(message, { cause: originalError })and theErrorWithCausefallback are unchanged at runtime but now type-check cleanly.Reviewed by Cursor Bugbot for commit 069ae2f. Bugbot is set up for automated code reviews on this repo. Configure here.