bd7d0f26b2
* Add test * Don’t allow an object literal with a spread as a fallback for destructuring a property not present in all constituents
16 lines
292 B
Plaintext
16 lines
292 B
Plaintext
=== tests/cases/compiler/destructuringFromUnionSpread.ts ===
|
|
interface A { a: string }
|
|
>a : string
|
|
|
|
interface B { b: number }
|
|
>b : number
|
|
|
|
declare const x: A | B;
|
|
>x : A | B
|
|
|
|
const { a } = { ...x } // error
|
|
>a : any
|
|
>{ ...x } : { a: any; } | { a: any; b: number; }
|
|
>x : A | B
|
|
|