TypeScript/tests/cases/compiler/unionReductionMutualSubtypes.ts
Anders Hejlsberg 2f0d07c29a
Increase selectivity of subtype relationship for signatures (#35659)
* Increase selectivity of subtype relationship for signatures

* Add regression test

* Accept new baselines

* Use strictSubtypeRelation for union subtype reduction

* (x: number | undefined) -> void is subtype of (x?: number | undefined) => void

* Accept new baselines

* Add tests

* Accept new baselines

* Address CR feedback

* Fix parameter list length check

* Accept API baseline changes
2019-12-20 14:52:22 -08:00

16 lines
312 B
TypeScript

// @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('');
}