Skip to content

Commit fa5181a

Browse files
committed
Accept new baselines
1 parent d338e40 commit fa5181a

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//// [deeplyNestedConstraints.ts]
2+
// Repro from #41931
3+
4+
type Enum = Record<string, string | number>;
5+
6+
type TypeMap<E extends Enum> = { [key in E[keyof E]]: number | boolean | string | number[] };
7+
8+
class BufferPool<E extends Enum, M extends TypeMap<E>> {
9+
setArray2<K extends E[keyof E]>(_: K, array: Extract<M[K], ArrayLike<any>>) {
10+
array.length; // Requires exploration of >5 levels of constraints
11+
}
12+
}
13+
14+
15+
//// [deeplyNestedConstraints.js]
16+
"use strict";
17+
// Repro from #41931
18+
var BufferPool = /** @class */ (function () {
19+
function BufferPool() {
20+
}
21+
BufferPool.prototype.setArray2 = function (_, array) {
22+
array.length; // Requires exploration of >5 levels of constraints
23+
};
24+
return BufferPool;
25+
}());
26+
27+
28+
//// [deeplyNestedConstraints.d.ts]
29+
declare type Enum = Record<string, string | number>;
30+
declare type TypeMap<E extends Enum> = {
31+
[key in E[keyof E]]: number | boolean | string | number[];
32+
};
33+
declare class BufferPool<E extends Enum, M extends TypeMap<E>> {
34+
setArray2<K extends E[keyof E]>(_: K, array: Extract<M[K], ArrayLike<any>>): void;
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
=== tests/cases/compiler/deeplyNestedConstraints.ts ===
2+
// Repro from #41931
3+
4+
type Enum = Record<string, string | number>;
5+
>Enum : Record<string, string | number>
6+
7+
type TypeMap<E extends Enum> = { [key in E[keyof E]]: number | boolean | string | number[] };
8+
>TypeMap : TypeMap<E>
9+
10+
class BufferPool<E extends Enum, M extends TypeMap<E>> {
11+
>BufferPool : BufferPool<E, M>
12+
13+
setArray2<K extends E[keyof E]>(_: K, array: Extract<M[K], ArrayLike<any>>) {
14+
>setArray2 : <K extends E[keyof E]>(_: K, array: Extract<M[K], ArrayLike<any>>) => void
15+
>_ : K
16+
>array : Extract<M[K], ArrayLike<any>>
17+
18+
array.length; // Requires exploration of >5 levels of constraints
19+
>array.length : number
20+
>array : Extract<M[K], ArrayLike<any>>
21+
>length : number
22+
}
23+
}
24+

0 commit comments

Comments
 (0)