Closed
Description
TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)
Code
interface Foo {
foo: string;
}
interface Bar {
bar: string;
}
function test(item: Foo | Bar) {
console.log(item.foo || item.bar)
}
Expected behavior:
This pattern is very common in javascript, that would be great to make it valid in typescript.
Actual behavior:
Property 'foo' does not exist on type 'Foo | Bar'.
Property 'foo' does not exist on type 'Bar'.
Property 'bar' does not exist on type 'Foo | Bar'.
Property 'bar' does not exist on type 'Foo'.