diff --git a/tests/cases/compiler/discriminantPropertyCheck.ts b/tests/cases/compiler/discriminantPropertyCheck.ts index 16fb847bdf0..a24fe07973b 100644 --- a/tests/cases/compiler/discriminantPropertyCheck.ts +++ b/tests/cases/compiler/discriminantPropertyCheck.ts @@ -99,3 +99,25 @@ function func2(inst: Instance) { } } } + +// Repro from #29106 + +const f = (_a: string, _b: string): void => {}; + +interface A { + a?: string; + b?: string; +} + +interface B { + a: string; + b: string; +} + +type U = A | B; + +const u: U = {} as any; + +u.a && u.b && f(u.a, u.b); + +u.b && u.a && f(u.a, u.b);