|
| 1 | +=== tests/cases/compiler/excessPropertyCheckingIntersectionWithConditional.ts === |
| 2 | +type Foo<K> = K extends unknown ? { a: number } : unknown |
| 3 | +>Foo : Symbol(Foo, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 0, 0)) |
| 4 | +>K : Symbol(K, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 0, 9)) |
| 5 | +>K : Symbol(K, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 0, 9)) |
| 6 | +>a : Symbol(a, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 0, 35)) |
| 7 | + |
| 8 | +const createDefaultExample = <K,>(x: K): Foo<K> & { x: K; } => { |
| 9 | +>createDefaultExample : Symbol(createDefaultExample, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 1, 5)) |
| 10 | +>K : Symbol(K, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 1, 30)) |
| 11 | +>x : Symbol(x, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 1, 34)) |
| 12 | +>K : Symbol(K, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 1, 30)) |
| 13 | +>Foo : Symbol(Foo, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 0, 0)) |
| 14 | +>K : Symbol(K, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 1, 30)) |
| 15 | +>x : Symbol(x, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 1, 51)) |
| 16 | +>K : Symbol(K, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 1, 30)) |
| 17 | + |
| 18 | + return { a: 1, x: x }; // okay in TS 4.7.4, error in TS 4.8.2 |
| 19 | +>a : Symbol(a, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 2, 10)) |
| 20 | +>x : Symbol(x, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 2, 16)) |
| 21 | +>x : Symbol(x, Decl(excessPropertyCheckingIntersectionWithConditional.ts, 1, 34)) |
| 22 | +} |
0 commit comments