|
| 1 | +=== tests/cases/compiler/deeplyNestedConstraints.ts === |
| 2 | +// Repro from #41931 |
| 3 | + |
| 4 | +type Enum = Record<string, string | number>; |
| 5 | +>Enum : Symbol(Enum, Decl(deeplyNestedConstraints.ts, 0, 0)) |
| 6 | +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) |
| 7 | + |
| 8 | +type TypeMap<E extends Enum> = { [key in E[keyof E]]: number | boolean | string | number[] }; |
| 9 | +>TypeMap : Symbol(TypeMap, Decl(deeplyNestedConstraints.ts, 2, 44)) |
| 10 | +>E : Symbol(E, Decl(deeplyNestedConstraints.ts, 4, 13)) |
| 11 | +>Enum : Symbol(Enum, Decl(deeplyNestedConstraints.ts, 0, 0)) |
| 12 | +>key : Symbol(key, Decl(deeplyNestedConstraints.ts, 4, 34)) |
| 13 | +>E : Symbol(E, Decl(deeplyNestedConstraints.ts, 4, 13)) |
| 14 | +>E : Symbol(E, Decl(deeplyNestedConstraints.ts, 4, 13)) |
| 15 | + |
| 16 | +class BufferPool<E extends Enum, M extends TypeMap<E>> { |
| 17 | +>BufferPool : Symbol(BufferPool, Decl(deeplyNestedConstraints.ts, 4, 93)) |
| 18 | +>E : Symbol(E, Decl(deeplyNestedConstraints.ts, 6, 17)) |
| 19 | +>Enum : Symbol(Enum, Decl(deeplyNestedConstraints.ts, 0, 0)) |
| 20 | +>M : Symbol(M, Decl(deeplyNestedConstraints.ts, 6, 32)) |
| 21 | +>TypeMap : Symbol(TypeMap, Decl(deeplyNestedConstraints.ts, 2, 44)) |
| 22 | +>E : Symbol(E, Decl(deeplyNestedConstraints.ts, 6, 17)) |
| 23 | + |
| 24 | + setArray2<K extends E[keyof E]>(_: K, array: Extract<M[K], ArrayLike<any>>) { |
| 25 | +>setArray2 : Symbol(BufferPool.setArray2, Decl(deeplyNestedConstraints.ts, 6, 56)) |
| 26 | +>K : Symbol(K, Decl(deeplyNestedConstraints.ts, 7, 14)) |
| 27 | +>E : Symbol(E, Decl(deeplyNestedConstraints.ts, 6, 17)) |
| 28 | +>E : Symbol(E, Decl(deeplyNestedConstraints.ts, 6, 17)) |
| 29 | +>_ : Symbol(_, Decl(deeplyNestedConstraints.ts, 7, 36)) |
| 30 | +>K : Symbol(K, Decl(deeplyNestedConstraints.ts, 7, 14)) |
| 31 | +>array : Symbol(array, Decl(deeplyNestedConstraints.ts, 7, 41)) |
| 32 | +>Extract : Symbol(Extract, Decl(lib.es5.d.ts, --, --)) |
| 33 | +>M : Symbol(M, Decl(deeplyNestedConstraints.ts, 6, 32)) |
| 34 | +>K : Symbol(K, Decl(deeplyNestedConstraints.ts, 7, 14)) |
| 35 | +>ArrayLike : Symbol(ArrayLike, Decl(lib.es5.d.ts, --, --)) |
| 36 | + |
| 37 | + array.length; // Requires exploration of >5 levels of constraints |
| 38 | +>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) |
| 39 | +>array : Symbol(array, Decl(deeplyNestedConstraints.ts, 7, 41)) |
| 40 | +>length : Symbol(length, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) |
| 41 | + } |
| 42 | +} |
| 43 | + |
0 commit comments