We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9844436 commit 83f7f4dCopy full SHA for 83f7f4d
tests/cases/compiler/discriminantPropertyCheck.ts
@@ -121,3 +121,29 @@ const u: U = {} as any;
121
u.a && u.b && f(u.a, u.b);
122
123
u.b && u.a && f(u.a, u.b);
124
+
125
+// Repro from #29496
126
127
+declare function never(value: never): never;
128
129
+const enum BarEnum {
130
+ bar1 = 1,
131
+ bar2 = 2,
132
+}
133
134
+type UnionOfBar = TypeBar1 | TypeBar2;
135
+type TypeBar1 = { type: BarEnum.bar1 };
136
+type TypeBar2 = { type: BarEnum.bar2 };
137
138
+function func3(value: Partial<UnionOfBar>) {
139
+ if (value.type !== undefined) {
140
+ switch (value.type) {
141
+ case BarEnum.bar1:
142
+ break;
143
+ case BarEnum.bar2:
144
145
+ default:
146
+ never(value.type);
147
+ }
148
149
0 commit comments