Allow satisfies
in string enum member initializers
#60060
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
π Search Terms
satisfies, enum
β Viability Checklist
β Suggestion
I suggest that TypeScript should allow this:
Currently this is treated as a computed enum member and requires
number
type, despite nothing being actually computed here.π Motivating Example
With
isolatedModules
/isolatedDeclarations
enabled references in enum members are restricted. For example, this does not compile withisolatedDeclarations
:satisfies
here will ensure thatFoo
is properly typed while not referring to external symbols:π» Use Cases
See motivating example above.
The text was updated successfully, but these errors were encountered: