-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Domain: 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
For example:
type Method = 'get' | 'post';
let app = {
get() { },
post() { },
foo() { },
bar: 123
};
let methodA = 'get';
let handlerA = app[methodA]; // typeof handlerA === () => void
let methodB: Method;
let handlerB = app[methodB]; // typeof handlerB === () => voidReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Domain: 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