-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 2.5.2
Code
type A = { type: "a", a: number }
type B = { type: "b", b: number }
type X = { type: A, a: string }
type Y = { type: B, b: string }
let x: X | Y
if (x.type.type === "a") {
x.a // Type Error
}
Expected behavior:
I would expect x to have type X
inside the if-statement after disambiguating the nested tagged union types.
Actual behavior:
geekflyer, cevek, zerkalica, pzavolinsky, AnyhowStep and 131 moreTwilightOwl, olriko, 6lr61, AlbertMarashi, ayame113 and 1 moreTwilightOwl, BrianHung, Julien-Marcou, zettca and finnmerlett
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript