-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: (2.0.0-beta)
Code
interface Test1 {
type: 'test1'
label: 'string'
}
interface Test2 {
type: 'test2'
}
let a: Test1 | Test2
if (a.type == 'test1') {
console.log(a.label) // works ok
setTimeout(()=>{
console.log(a.label) // Error: Property 'label' does not exist on type 'Test1 | Test2'
})
}Expected behavior:
setTimeout case should work ?
Actual behavior:
Error: Property 'label' does not exist on type 'Test1 | Test2' in setTimeout
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created