-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Hi,
The most obvious case is for enums:
enum Foo {
bar,
allBarOne
}
function f(foo: Foo) {
foo === // list Foo members here
}Should also work for boolean (although such comparisons are not very common).
Another case is for typeof in the context of union types:
function f(foo: string|number) {
typeof foo === // 'string', 'number'
}One problem with this case is that an option for single vs double quotes would need to be provided.
And also instanceof
class Foo {}
function f(foo: Foo|Array<number>) {
foo instanceof // Foo, Array<number>
}Metadata
Metadata
Assignees
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript