1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
//// [circularIndexedAccessErrors.ts]
type T1 = {
x: T1["x"]; // Error
};
type T2<K extends "x" | "y"> = {
x: T2<K>[K]; // Error
y: number;
}
declare let x2: T2<"x">;
let x2x = x2.x;
interface T3<T extends T3<T>> {
x: T["x"];
}
interface T4<T extends T4<T>> {
x: T4<T>["x"]; // Error
}
class C1 {
x: C1["x"]; // Error
}
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;
var C1 = /** @class */ (function () {
function C1() {
}
return C1;
}());
var C2 = /** @class */ (function () {
function C2() {
}
return C2;
}());
function foo() {
}
//// [circularIndexedAccessErrors.d.ts]
declare type T1 = {
x: T1["x"];
};
declare type T2<K extends "x" | "y"> = {
x: T2<K>[K];
y: number;
};
declare let x2: T2<"x">;
declare let x2x: any;
interface T3<T extends T3<T>> {
x: T["x"];
}
interface T4<T extends T4<T>> {
x: T4<T>["x"];
}
declare class C1 {
x: C1["x"];
}
declare class C2 {
x: this["y"];
y: this["z"];
z: this["x"];
}
interface Foo {
hello: boolean;
}
declare function foo<T extends Foo | T["hello"]>(): void;
|