-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
It's probably duplicate but it's not easy to find so apologies if it is
interface A {
a: string // or `a: 'a'`
}
interface B {
a: number
}
declare var c:A|B
if (typeof c.a == 'string') { // or `if (c.a == 'a')`
c // <- Type: A|B, should be A ?
}
else {
c // <- Type: A|B, should be B ?
}
// where this seems ok:
declare var d:string|number // or `'a'|number`
if (typeof d == 'string') { // or `if (d == 'a')`
d // Type: string // Type: 'a'
}
else {
d // Type: number
}basarat
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript