mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
25 lines
643 B
TypeScript
25 lines
643 B
TypeScript
//// [tests/cases/compiler/discriminableUnionWithIntersectedMembers.ts] ////
|
|
|
|
//// [discriminableUnionWithIntersectedMembers.ts]
|
|
// 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 };
|
|
|
|
//// [discriminableUnionWithIntersectedMembers.js]
|
|
"use strict";
|
|
// error
|
|
const x = 4;
|
|
// no error
|
|
const y = 4;
|