|
| 1 | +=== tests/cases/conformance/types/intersection/intersectionTypeInference3.ts === |
| 2 | +// Repro from #19682 |
| 3 | + |
| 4 | +type Nominal<Kind extends string, Type> = Type & { |
| 5 | +>Nominal : Symbol(Nominal, Decl(intersectionTypeInference3.ts, 0, 0)) |
| 6 | +>Kind : Symbol(Kind, Decl(intersectionTypeInference3.ts, 2, 13)) |
| 7 | +>Type : Symbol(Type, Decl(intersectionTypeInference3.ts, 2, 33)) |
| 8 | +>Type : Symbol(Type, Decl(intersectionTypeInference3.ts, 2, 33)) |
| 9 | + |
| 10 | + [Symbol.species]: Kind; |
| 11 | +>Symbol.species : Symbol(SymbolConstructor.species, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 12 | +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) |
| 13 | +>species : Symbol(SymbolConstructor.species, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 14 | +>Kind : Symbol(Kind, Decl(intersectionTypeInference3.ts, 2, 13)) |
| 15 | + |
| 16 | +}; |
| 17 | + |
| 18 | +type A = Nominal<'A', string>; |
| 19 | +>A : Symbol(A, Decl(intersectionTypeInference3.ts, 4, 2)) |
| 20 | +>Nominal : Symbol(Nominal, Decl(intersectionTypeInference3.ts, 0, 0)) |
| 21 | + |
| 22 | +declare const a: Set<A>; |
| 23 | +>a : Symbol(a, Decl(intersectionTypeInference3.ts, 8, 13)) |
| 24 | +>Set : Symbol(Set, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) |
| 25 | +>A : Symbol(A, Decl(intersectionTypeInference3.ts, 4, 2)) |
| 26 | + |
| 27 | +declare const b: Set<A>; |
| 28 | +>b : Symbol(b, Decl(intersectionTypeInference3.ts, 9, 13)) |
| 29 | +>Set : Symbol(Set, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) |
| 30 | +>A : Symbol(A, Decl(intersectionTypeInference3.ts, 4, 2)) |
| 31 | + |
| 32 | +const c1 = Array.from(a).concat(Array.from(b)); |
| 33 | +>c1 : Symbol(c1, Decl(intersectionTypeInference3.ts, 11, 5)) |
| 34 | +>Array.from(a).concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) |
| 35 | +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) |
| 36 | +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) |
| 37 | +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) |
| 38 | +>a : Symbol(a, Decl(intersectionTypeInference3.ts, 8, 13)) |
| 39 | +>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) |
| 40 | +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) |
| 41 | +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) |
| 42 | +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) |
| 43 | +>b : Symbol(b, Decl(intersectionTypeInference3.ts, 9, 13)) |
| 44 | + |
| 45 | +// Simpler repro |
| 46 | + |
| 47 | +declare function from<T>(): T[]; |
| 48 | +>from : Symbol(from, Decl(intersectionTypeInference3.ts, 11, 47)) |
| 49 | +>T : Symbol(T, Decl(intersectionTypeInference3.ts, 15, 22)) |
| 50 | +>T : Symbol(T, Decl(intersectionTypeInference3.ts, 15, 22)) |
| 51 | + |
| 52 | +const c2: ReadonlyArray<A> = from(); |
| 53 | +>c2 : Symbol(c2, Decl(intersectionTypeInference3.ts, 16, 5)) |
| 54 | +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) |
| 55 | +>A : Symbol(A, Decl(intersectionTypeInference3.ts, 4, 2)) |
| 56 | +>from : Symbol(from, Decl(intersectionTypeInference3.ts, 11, 47)) |
| 57 | + |
0 commit comments