14 lines
401 B
TypeScript
14 lines
401 B
TypeScript
|
// regression test for https://github.com/microsoft/TypeScript/issues/33243
|
||
|
type X =
|
||
|
| { x: 'x', y: number } & { y: number }
|
||
|
| { x: 'y', y: number, z?: boolean } & { y: number }
|
||
|
|
||
|
// error
|
||
|
const x: X = 4 as any as { x: 'x' | 'y', y: number };
|
||
|
|
||
|
type Y =
|
||
|
| { x: 'x', y: number }
|
||
|
| { x: 'y', y: number, z?: boolean }
|
||
|
|
||
|
// no error
|
||
|
const y: Y = 4 as any as { x: 'x' | 'y', y: number };
|