diff --git a/tests/cases/compiler/unionReductionMutualSubtypes.ts b/tests/cases/compiler/unionReductionMutualSubtypes.ts new file mode 100644 index 00000000000..aa1c1320a0d --- /dev/null +++ b/tests/cases/compiler/unionReductionMutualSubtypes.ts @@ -0,0 +1,15 @@ +// @strict: true + +// Repro from #35414 + +interface ReturnVal { + something(): void; +} + +const k: ReturnVal = { something() { } } + +declare const val: ReturnVal; +function run(options: { something?(b?: string): void }) { + const something = options.something ?? val.something; + something(''); +}