refactor: ban TypeScript enums across internal-snaps - #213
Closed
ulissesferreira wants to merge 1 commit into
Closed
refactor: ban TypeScript enums across internal-snaps#213ulissesferreira wants to merge 1 commit into
ulissesferreira wants to merge 1 commit into
Conversation
Convert all locally-declared `enum` and `const enum` declarations to `as const` objects with derived union types (Pattern A). **BREAKING CHANGES:** - Type signatures change: `Enum` is now a union of string/number literals instead of a nominal enum type - `typeof Enum.Member` expressions in type positions now refer to literal values instead of enum member types **Packages affected:** - bitcoin-wallet-snap: 10 enums converted - solana-wallet-snap: 16 enums converted - tron-wallet-snap: 11 enums converted - stellar-wallet-snap: converted (deferred, partial) **Also included:** - ESLint rule banning new `TSEnumDeclaration` via `no-restricted-syntax` - Changelogs for bitcoin, solana, and tron packages - Type fixes for template literal types, namespace usage patterns, and array .includes() typing after enum-to-const conversion Refs: MetaMask/utils#280, MetaMask/eslint-config#417
Contributor
Author
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.
Superseded
This monolith PR has been split into per-network PRs. Please review those instead:
Note: Stellar is still incomplete (half-applied, partially wrong state) and was excluded from the split. It should land separately once fully completed.
Closing this in favor of the per-network PRs.