Add additional regression test
This commit is contained in:
parent
f1da780a5e
commit
855488fc6d
|
@ -2,9 +2,11 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(3,5): error T
|
|||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(7,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(19,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(23,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(38,24): error TS2313: Type parameter 'T' has a circular constraint.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(38,30): error TS2536: Type '"hello"' cannot be used to index type 'T'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (4 errors) ====
|
||||
==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (6 errors) ====
|
||||
|
||||
type T1 = {
|
||||
x: T1["x"]; // Error
|
||||
|
@ -42,4 +44,18 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(23,5): error
|
|||
x: this["y"];
|
||||
y: this["z"];
|
||||
z: this["x"];
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #12627
|
||||
|
||||
interface Foo {
|
||||
hello: boolean;
|
||||
}
|
||||
|
||||
function foo<T extends Foo | T["hello"]>() {
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2313: Type parameter 'T' has a circular constraint.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2536: Type '"hello"' cannot be used to index type 'T'.
|
||||
}
|
||||
|
|
@ -28,7 +28,17 @@ class C2 {
|
|||
x: this["y"];
|
||||
y: this["z"];
|
||||
z: this["x"];
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #12627
|
||||
|
||||
interface Foo {
|
||||
hello: boolean;
|
||||
}
|
||||
|
||||
function foo<T extends Foo | T["hello"]>() {
|
||||
}
|
||||
|
||||
|
||||
//// [circularIndexedAccessErrors.js]
|
||||
var x2x = x2.x;
|
||||
|
@ -42,6 +52,8 @@ var C2 = (function () {
|
|||
}
|
||||
return C2;
|
||||
}());
|
||||
function foo() {
|
||||
}
|
||||
|
||||
|
||||
//// [circularIndexedAccessErrors.d.ts]
|
||||
|
@ -68,3 +80,7 @@ declare class C2 {
|
|||
y: this["z"];
|
||||
z: this["x"];
|
||||
}
|
||||
interface Foo {
|
||||
hello: boolean;
|
||||
}
|
||||
declare function foo<T extends Foo | T["hello"]>(): void;
|
||||
|
|
|
@ -28,4 +28,13 @@ class C2 {
|
|||
x: this["y"];
|
||||
y: this["z"];
|
||||
z: this["x"];
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #12627
|
||||
|
||||
interface Foo {
|
||||
hello: boolean;
|
||||
}
|
||||
|
||||
function foo<T extends Foo | T["hello"]>() {
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue