Add additional regression test
This commit is contained in:
parent
f1da780a5e
commit
855488fc6d
3 changed files with 45 additions and 4 deletions
|
@ -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(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(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(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 = {
|
type T1 = {
|
||||||
x: T1["x"]; // Error
|
x: T1["x"]; // Error
|
||||||
|
@ -43,3 +45,17 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(23,5): error
|
||||||
y: this["z"];
|
y: this["z"];
|
||||||
z: this["x"];
|
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'.
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,16 @@ class C2 {
|
||||||
z: this["x"];
|
z: this["x"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Repro from #12627
|
||||||
|
|
||||||
|
interface Foo {
|
||||||
|
hello: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function foo<T extends Foo | T["hello"]>() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//// [circularIndexedAccessErrors.js]
|
//// [circularIndexedAccessErrors.js]
|
||||||
var x2x = x2.x;
|
var x2x = x2.x;
|
||||||
var C1 = (function () {
|
var C1 = (function () {
|
||||||
|
@ -42,6 +52,8 @@ var C2 = (function () {
|
||||||
}
|
}
|
||||||
return C2;
|
return C2;
|
||||||
}());
|
}());
|
||||||
|
function foo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//// [circularIndexedAccessErrors.d.ts]
|
//// [circularIndexedAccessErrors.d.ts]
|
||||||
|
@ -68,3 +80,7 @@ declare class C2 {
|
||||||
y: this["z"];
|
y: this["z"];
|
||||||
z: this["x"];
|
z: this["x"];
|
||||||
}
|
}
|
||||||
|
interface Foo {
|
||||||
|
hello: boolean;
|
||||||
|
}
|
||||||
|
declare function foo<T extends Foo | T["hello"]>(): void;
|
||||||
|
|
|
@ -29,3 +29,12 @@ class C2 {
|
||||||
y: this["z"];
|
y: this["z"];
|
||||||
z: this["x"];
|
z: this["x"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Repro from #12627
|
||||||
|
|
||||||
|
interface Foo {
|
||||||
|
hello: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function foo<T extends Foo | T["hello"]>() {
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue