|
| 1 | +=== tests/cases/compiler/unionReductionMutualSubtypes.ts === |
| 2 | +// Repro from #35414 |
| 3 | + |
| 4 | +interface ReturnVal { |
| 5 | +>ReturnVal : Symbol(ReturnVal, Decl(unionReductionMutualSubtypes.ts, 0, 0)) |
| 6 | + |
| 7 | + something(): void; |
| 8 | +>something : Symbol(ReturnVal.something, Decl(unionReductionMutualSubtypes.ts, 2, 21)) |
| 9 | +} |
| 10 | + |
| 11 | +const k: ReturnVal = { something() { } } |
| 12 | +>k : Symbol(k, Decl(unionReductionMutualSubtypes.ts, 6, 5)) |
| 13 | +>ReturnVal : Symbol(ReturnVal, Decl(unionReductionMutualSubtypes.ts, 0, 0)) |
| 14 | +>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 6, 22)) |
| 15 | + |
| 16 | +declare const val: ReturnVal; |
| 17 | +>val : Symbol(val, Decl(unionReductionMutualSubtypes.ts, 8, 13)) |
| 18 | +>ReturnVal : Symbol(ReturnVal, Decl(unionReductionMutualSubtypes.ts, 0, 0)) |
| 19 | + |
| 20 | +function run(options: { something?(b?: string): void }) { |
| 21 | +>run : Symbol(run, Decl(unionReductionMutualSubtypes.ts, 8, 29)) |
| 22 | +>options : Symbol(options, Decl(unionReductionMutualSubtypes.ts, 9, 13)) |
| 23 | +>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 9, 23)) |
| 24 | +>b : Symbol(b, Decl(unionReductionMutualSubtypes.ts, 9, 35)) |
| 25 | + |
| 26 | + const something = options.something ?? val.something; |
| 27 | +>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 10, 9)) |
| 28 | +>options.something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 9, 23)) |
| 29 | +>options : Symbol(options, Decl(unionReductionMutualSubtypes.ts, 9, 13)) |
| 30 | +>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 9, 23)) |
| 31 | +>val.something : Symbol(ReturnVal.something, Decl(unionReductionMutualSubtypes.ts, 2, 21)) |
| 32 | +>val : Symbol(val, Decl(unionReductionMutualSubtypes.ts, 8, 13)) |
| 33 | +>something : Symbol(ReturnVal.something, Decl(unionReductionMutualSubtypes.ts, 2, 21)) |
| 34 | + |
| 35 | + something(''); |
| 36 | +>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 10, 9)) |
| 37 | +} |
| 38 | + |
0 commit comments