Skip to content

Commit 2f85af8

Browse files
committed
Accept new baselines
1 parent db9c202 commit 2f85af8

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

tests/baselines/reference/infiniteConstraints.errors.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ tests/cases/compiler/infiniteConstraints.ts(4,37): error TS2536: Type '"val"' ca
22
tests/cases/compiler/infiniteConstraints.ts(31,42): error TS2345: Argument of type '{ main: Record<"val", "dup">; alternate: Record<"val", "dup">; }' is not assignable to parameter of type '{ main: never; alternate: never; }'.
33
Types of property 'main' are incompatible.
44
Type 'Record<"val", "dup">' is not assignable to type 'never'.
5+
tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2536: Type '"foo"' cannot be used to index type 'T[keyof T]'.
56

67

7-
==== tests/cases/compiler/infiniteConstraints.ts (2 errors) ====
8+
==== tests/cases/compiler/infiniteConstraints.ts (3 errors) ====
89
// Both of the following types trigger the recursion limiter in getImmediateBaseConstraint
910

1011
type T1<B extends { [K in keyof B]: Extract<B[Exclude<keyof B, K>], { val: string }>["val"] }> = B;
@@ -42,4 +43,11 @@ tests/cases/compiler/infiniteConstraints.ts(31,42): error TS2345: Argument of ty
4243
!!! error TS2345: Argument of type '{ main: Record<"val", "dup">; alternate: Record<"val", "dup">; }' is not assignable to parameter of type '{ main: never; alternate: never; }'.
4344
!!! error TS2345: Types of property 'main' are incompatible.
4445
!!! error TS2345: Type 'Record<"val", "dup">' is not assignable to type 'never'.
46+
47+
// Repro from #26448
48+
49+
type Cond<T> = T extends number ? number : never;
50+
declare function function1<T extends {[K in keyof T]: Cond<T[K]>}>(): T[keyof T]["foo"];
51+
~~~~~~~~~~~~~~~~~
52+
!!! error TS2536: Type '"foo"' cannot be used to index type 'T[keyof T]'.
4553

tests/baselines/reference/infiniteConstraints.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const noError = ensureNoDuplicates({main: value("test"), alternate: value("test2
3030
const shouldBeNoError = ensureNoDuplicates({main: value("test")});
3131

3232
const shouldBeError = ensureNoDuplicates({main: value("dup"), alternate: value("dup")});
33+
34+
// Repro from #26448
35+
36+
type Cond<T> = T extends number ? number : never;
37+
declare function function1<T extends {[K in keyof T]: Cond<T[K]>}>(): T[keyof T]["foo"];
3338

3439

3540
//// [infiniteConstraints.js]

tests/baselines/reference/infiniteConstraints.symbols

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,21 @@ const shouldBeError = ensureNoDuplicates({main: value("dup"), alternate: value("
120120
>alternate : Symbol(alternate, Decl(infiniteConstraints.ts, 30, 61))
121121
>value : Symbol(value, Decl(infiniteConstraints.ts, 15, 57))
122122

123+
// Repro from #26448
124+
125+
type Cond<T> = T extends number ? number : never;
126+
>Cond : Symbol(Cond, Decl(infiniteConstraints.ts, 30, 88))
127+
>T : Symbol(T, Decl(infiniteConstraints.ts, 34, 10))
128+
>T : Symbol(T, Decl(infiniteConstraints.ts, 34, 10))
129+
130+
declare function function1<T extends {[K in keyof T]: Cond<T[K]>}>(): T[keyof T]["foo"];
131+
>function1 : Symbol(function1, Decl(infiniteConstraints.ts, 34, 49))
132+
>T : Symbol(T, Decl(infiniteConstraints.ts, 35, 27))
133+
>K : Symbol(K, Decl(infiniteConstraints.ts, 35, 39))
134+
>T : Symbol(T, Decl(infiniteConstraints.ts, 35, 27))
135+
>Cond : Symbol(Cond, Decl(infiniteConstraints.ts, 30, 88))
136+
>T : Symbol(T, Decl(infiniteConstraints.ts, 35, 27))
137+
>K : Symbol(K, Decl(infiniteConstraints.ts, 35, 39))
138+
>T : Symbol(T, Decl(infiniteConstraints.ts, 35, 27))
139+
>T : Symbol(T, Decl(infiniteConstraints.ts, 35, 27))
140+

tests/baselines/reference/infiniteConstraints.types

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,11 @@ const shouldBeError = ensureNoDuplicates({main: value("dup"), alternate: value("
8787
>value : <V extends string>(val: V) => Record<"val", V>
8888
>"dup" : "dup"
8989

90+
// Repro from #26448
91+
92+
type Cond<T> = T extends number ? number : never;
93+
>Cond : Cond<T>
94+
95+
declare function function1<T extends {[K in keyof T]: Cond<T[K]>}>(): T[keyof T]["foo"];
96+
>function1 : <T extends { [K in keyof T]: Cond<T[K]>; }>() => T[keyof T]["foo"]
97+

0 commit comments

Comments
 (0)