We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2082ef2 commit 94afa32Copy full SHA for 94afa32
tests/baselines/reference/circularBaseTypes.errors.txt
@@ -1,8 +1,10 @@
1
tests/cases/compiler/circularBaseTypes.ts(4,11): error TS2310: Type 'M2' recursively references itself as a base type.
2
tests/cases/compiler/circularBaseTypes.ts(5,6): error TS2456: Type alias 'M3' circularly references itself.
3
+tests/cases/compiler/circularBaseTypes.ts(13,21): error TS2313: Type parameter 'K' has a circular constraint.
4
+tests/cases/compiler/circularBaseTypes.ts(14,11): error TS2310: Type 'Y' recursively references itself as a base type.
5
6
-==== tests/cases/compiler/circularBaseTypes.ts (2 errors) ====
7
+==== tests/cases/compiler/circularBaseTypes.ts (4 errors) ====
8
// Repro from #38098
9
10
type M<T> = { value: T };
@@ -16,4 +18,16 @@ tests/cases/compiler/circularBaseTypes.ts(5,6): error TS2456: Type alias 'M3' ci
16
18
function f(m: M3) {
17
19
return m.value;
20
}
21
+
22
+ // Repro from #32581
23
24
+ type X<T> = { [K in keyof T]: string } & { b: string };
25
+ ~~~~~~~
26
+!!! error TS2313: Type parameter 'K' has a circular constraint.
27
+!!! related TS2751 tests/cases/compiler/circularBaseTypes.ts:14:11: Circularity originates in type at this location.
28
+ interface Y extends X<Y> {
29
+ ~
30
+!!! error TS2310: Type 'Y' recursively references itself as a base type.
31
+ a: "";
32
+ }
33
tests/baselines/reference/circularBaseTypes.js
@@ -8,6 +8,13 @@ type M3 = M2[keyof M2]; // Error
11
12
+// Repro from #32581
13
14
+type X<T> = { [K in keyof T]: string } & { b: string };
15
+interface Y extends X<Y> {
+}
//// [circularBaseTypes.js]
@@ -27,3 +34,11 @@ interface M2 extends M<M3> {
34
35
type M3 = M2[keyof M2];
36
declare function f(m: M3): any;
37
+type X<T> = {
38
+ [K in keyof T]: string;
39
+} & {
40
+ b: string;
41
+};
42
43
44
tests/baselines/reference/circularBaseTypes.symbols
@@ -26,3 +26,21 @@ function f(m: M3) {
>m : Symbol(m, Decl(circularBaseTypes.ts, 6, 11))
+>X : Symbol(X, Decl(circularBaseTypes.ts, 8, 1))
+>T : Symbol(T, Decl(circularBaseTypes.ts, 12, 7))
+>K : Symbol(K, Decl(circularBaseTypes.ts, 12, 15))
+>b : Symbol(b, Decl(circularBaseTypes.ts, 12, 42))
+>Y : Symbol(Y, Decl(circularBaseTypes.ts, 12, 55))
+>a : Symbol(Y.a, Decl(circularBaseTypes.ts, 13, 26))
45
46
tests/baselines/reference/circularBaseTypes.types
@@ -19,3 +19,14 @@ function f(m: M3) {
>value : any
+>X : X<T>
+>b : string
+>a : ""
tests/cases/compiler/circularBaseTypes.ts
@@ -10,3 +10,10 @@ type M3 = M2[keyof M2]; // Error
0 commit comments