Unique type #59431
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
"unique type"
β Viability Checklist
β Suggestion
Sometimes I just need a unique type as flags in my type calculations. If I use a string subtype or others it couldn't be identity well. Such as:
In the code,
Flag
is also a string. I don't want to post some complex types which references each other and using flag types but it is really useful for me.Define a pure unique type without any runtime content.
π Motivating Example
Flag1
is notFlag2
like unique symbols.The unique types only extends itself for checking what it is.
Pass a text to
unique
keyword to create a unique type.π» Use Cases
To control the type calculation especially in recursive type definitions.
If I define a unique symbol, it should produce a runtime symbol.
Write flag with string sub-type carefully.
The text was updated successfully, but these errors were encountered: