|
| 1 | +=== tests/cases/compiler/primitiveUnionDetection.ts === |
| 2 | +// Repro from #46624 |
| 3 | + |
| 4 | +type Kind = "one" | "two" | "three"; |
| 5 | +>Kind : Symbol(Kind, Decl(primitiveUnionDetection.ts, 0, 0)) |
| 6 | + |
| 7 | +declare function getInterfaceFromString<T extends Kind>(options?: { type?: T } & { type?: Kind }): T; |
| 8 | +>getInterfaceFromString : Symbol(getInterfaceFromString, Decl(primitiveUnionDetection.ts, 2, 36)) |
| 9 | +>T : Symbol(T, Decl(primitiveUnionDetection.ts, 4, 40)) |
| 10 | +>Kind : Symbol(Kind, Decl(primitiveUnionDetection.ts, 0, 0)) |
| 11 | +>options : Symbol(options, Decl(primitiveUnionDetection.ts, 4, 56)) |
| 12 | +>type : Symbol(type, Decl(primitiveUnionDetection.ts, 4, 67)) |
| 13 | +>T : Symbol(T, Decl(primitiveUnionDetection.ts, 4, 40)) |
| 14 | +>type : Symbol(type, Decl(primitiveUnionDetection.ts, 4, 82)) |
| 15 | +>Kind : Symbol(Kind, Decl(primitiveUnionDetection.ts, 0, 0)) |
| 16 | +>T : Symbol(T, Decl(primitiveUnionDetection.ts, 4, 40)) |
| 17 | + |
| 18 | +const result = getInterfaceFromString({ type: 'two' }); |
| 19 | +>result : Symbol(result, Decl(primitiveUnionDetection.ts, 6, 5)) |
| 20 | +>getInterfaceFromString : Symbol(getInterfaceFromString, Decl(primitiveUnionDetection.ts, 2, 36)) |
| 21 | +>type : Symbol(type, Decl(primitiveUnionDetection.ts, 6, 39)) |
| 22 | + |
0 commit comments