-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueDomain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Now that the string literal types #5185 are merged in, the type guards based on them would be an awesome addition:
by @ahejlsberg:
Type guards could relate the common kind property to the corresponding object type in the union and narrow the type appropriately in the guarded block.
The original issue #1003 got closed with the following comment:
the remaining part is extending the type guards to support the string literal types. but this should be tracked by a different issue.
A quick search suggests that there isn't a ticket for this yet. So here we go.
RReverser, sampsyo, iKBAHT and domharries
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueDomain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript