|
| 1 | +//// [tests/cases/compiler/inferToDistributiveConditionalType1.ts] //// |
| 2 | + |
| 3 | +=== inferToDistributiveConditionalType1.ts === |
| 4 | +declare class Animal { eat(): void; } |
| 5 | +>Animal : Symbol(Animal, Decl(inferToDistributiveConditionalType1.ts, 0, 0)) |
| 6 | +>eat : Symbol(Animal.eat, Decl(inferToDistributiveConditionalType1.ts, 0, 22)) |
| 7 | + |
| 8 | +declare class Cat extends Animal { meow(): void; } |
| 9 | +>Cat : Symbol(Cat, Decl(inferToDistributiveConditionalType1.ts, 0, 37)) |
| 10 | +>Animal : Symbol(Animal, Decl(inferToDistributiveConditionalType1.ts, 0, 0)) |
| 11 | +>meow : Symbol(Cat.meow, Decl(inferToDistributiveConditionalType1.ts, 1, 34)) |
| 12 | + |
| 13 | +declare class Dog extends Animal { bark(): void; } |
| 14 | +>Dog : Symbol(Dog, Decl(inferToDistributiveConditionalType1.ts, 1, 50)) |
| 15 | +>Animal : Symbol(Animal, Decl(inferToDistributiveConditionalType1.ts, 0, 0)) |
| 16 | +>bark : Symbol(Dog.bark, Decl(inferToDistributiveConditionalType1.ts, 2, 34)) |
| 17 | + |
| 18 | +declare function test1<T>(a: T extends unknown ? { prop: T } : never): T; |
| 19 | +>test1 : Symbol(test1, Decl(inferToDistributiveConditionalType1.ts, 2, 50)) |
| 20 | +>T : Symbol(T, Decl(inferToDistributiveConditionalType1.ts, 4, 23)) |
| 21 | +>a : Symbol(a, Decl(inferToDistributiveConditionalType1.ts, 4, 26)) |
| 22 | +>T : Symbol(T, Decl(inferToDistributiveConditionalType1.ts, 4, 23)) |
| 23 | +>prop : Symbol(prop, Decl(inferToDistributiveConditionalType1.ts, 4, 50)) |
| 24 | +>T : Symbol(T, Decl(inferToDistributiveConditionalType1.ts, 4, 23)) |
| 25 | +>T : Symbol(T, Decl(inferToDistributiveConditionalType1.ts, 4, 23)) |
| 26 | + |
| 27 | +declare const arg1: { prop: Dog } | { prop: Cat }; |
| 28 | +>arg1 : Symbol(arg1, Decl(inferToDistributiveConditionalType1.ts, 5, 13)) |
| 29 | +>prop : Symbol(prop, Decl(inferToDistributiveConditionalType1.ts, 5, 21)) |
| 30 | +>Dog : Symbol(Dog, Decl(inferToDistributiveConditionalType1.ts, 1, 50)) |
| 31 | +>prop : Symbol(prop, Decl(inferToDistributiveConditionalType1.ts, 5, 37)) |
| 32 | +>Cat : Symbol(Cat, Decl(inferToDistributiveConditionalType1.ts, 0, 37)) |
| 33 | + |
| 34 | +const result1 = test1(arg1); |
| 35 | +>result1 : Symbol(result1, Decl(inferToDistributiveConditionalType1.ts, 6, 5)) |
| 36 | +>test1 : Symbol(test1, Decl(inferToDistributiveConditionalType1.ts, 2, 50)) |
| 37 | +>arg1 : Symbol(arg1, Decl(inferToDistributiveConditionalType1.ts, 5, 13)) |
| 38 | + |
0 commit comments