mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Add regression test
This commit is contained in:
@@ -121,3 +121,29 @@ const u: U = {} as any;
|
||||
u.a && u.b && f(u.a, u.b);
|
||||
|
||||
u.b && u.a && f(u.a, u.b);
|
||||
|
||||
// Repro from #29496
|
||||
|
||||
declare function never(value: never): never;
|
||||
|
||||
const enum BarEnum {
|
||||
bar1 = 1,
|
||||
bar2 = 2,
|
||||
}
|
||||
|
||||
type UnionOfBar = TypeBar1 | TypeBar2;
|
||||
type TypeBar1 = { type: BarEnum.bar1 };
|
||||
type TypeBar2 = { type: BarEnum.bar2 };
|
||||
|
||||
function func3(value: Partial<UnionOfBar>) {
|
||||
if (value.type !== undefined) {
|
||||
switch (value.type) {
|
||||
case BarEnum.bar1:
|
||||
break;
|
||||
case BarEnum.bar2:
|
||||
break;
|
||||
default:
|
||||
never(value.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user