mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
97 lines
3.3 KiB
Plaintext
97 lines
3.3 KiB
Plaintext
//// [tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts] ////
|
|
|
|
=== circularIndexedAccessErrors.ts ===
|
|
type T1 = {
|
|
>T1 : Symbol(T1, Decl(circularIndexedAccessErrors.ts, 0, 0))
|
|
|
|
x: T1["x"]; // Error
|
|
>x : Symbol(x, Decl(circularIndexedAccessErrors.ts, 0, 11))
|
|
>T1 : Symbol(T1, Decl(circularIndexedAccessErrors.ts, 0, 0))
|
|
|
|
};
|
|
|
|
type T2<K extends "x" | "y"> = {
|
|
>T2 : Symbol(T2, Decl(circularIndexedAccessErrors.ts, 2, 2))
|
|
>K : Symbol(K, Decl(circularIndexedAccessErrors.ts, 4, 8))
|
|
|
|
x: T2<K>[K]; // Error
|
|
>x : Symbol(x, Decl(circularIndexedAccessErrors.ts, 4, 32))
|
|
>T2 : Symbol(T2, Decl(circularIndexedAccessErrors.ts, 2, 2))
|
|
>K : Symbol(K, Decl(circularIndexedAccessErrors.ts, 4, 8))
|
|
>K : Symbol(K, Decl(circularIndexedAccessErrors.ts, 4, 8))
|
|
|
|
y: number;
|
|
>y : Symbol(y, Decl(circularIndexedAccessErrors.ts, 5, 16))
|
|
}
|
|
|
|
declare let x2: T2<"x">;
|
|
>x2 : Symbol(x2, Decl(circularIndexedAccessErrors.ts, 9, 11))
|
|
>T2 : Symbol(T2, Decl(circularIndexedAccessErrors.ts, 2, 2))
|
|
|
|
let x2x = x2.x;
|
|
>x2x : Symbol(x2x, Decl(circularIndexedAccessErrors.ts, 10, 3))
|
|
>x2.x : Symbol(x, Decl(circularIndexedAccessErrors.ts, 4, 32))
|
|
>x2 : Symbol(x2, Decl(circularIndexedAccessErrors.ts, 9, 11))
|
|
>x : Symbol(x, Decl(circularIndexedAccessErrors.ts, 4, 32))
|
|
|
|
interface T3<T extends T3<T>> {
|
|
>T3 : Symbol(T3, Decl(circularIndexedAccessErrors.ts, 10, 15))
|
|
>T : Symbol(T, Decl(circularIndexedAccessErrors.ts, 12, 13))
|
|
>T3 : Symbol(T3, Decl(circularIndexedAccessErrors.ts, 10, 15))
|
|
>T : Symbol(T, Decl(circularIndexedAccessErrors.ts, 12, 13))
|
|
|
|
x: T["x"];
|
|
>x : Symbol(T3.x, Decl(circularIndexedAccessErrors.ts, 12, 31))
|
|
>T : Symbol(T, Decl(circularIndexedAccessErrors.ts, 12, 13))
|
|
}
|
|
|
|
interface T4<T extends T4<T>> {
|
|
>T4 : Symbol(T4, Decl(circularIndexedAccessErrors.ts, 14, 1))
|
|
>T : Symbol(T, Decl(circularIndexedAccessErrors.ts, 16, 13))
|
|
>T4 : Symbol(T4, Decl(circularIndexedAccessErrors.ts, 14, 1))
|
|
>T : Symbol(T, Decl(circularIndexedAccessErrors.ts, 16, 13))
|
|
|
|
x: T4<T>["x"]; // Error
|
|
>x : Symbol(T4.x, Decl(circularIndexedAccessErrors.ts, 16, 31))
|
|
>T4 : Symbol(T4, Decl(circularIndexedAccessErrors.ts, 14, 1))
|
|
>T : Symbol(T, Decl(circularIndexedAccessErrors.ts, 16, 13))
|
|
}
|
|
|
|
class C1 {
|
|
>C1 : Symbol(C1, Decl(circularIndexedAccessErrors.ts, 18, 1))
|
|
|
|
x: C1["x"]; // Error
|
|
>x : Symbol(C1.x, Decl(circularIndexedAccessErrors.ts, 20, 10))
|
|
>C1 : Symbol(C1, Decl(circularIndexedAccessErrors.ts, 18, 1))
|
|
}
|
|
|
|
class C2 {
|
|
>C2 : Symbol(C2, Decl(circularIndexedAccessErrors.ts, 22, 1))
|
|
|
|
x: this["y"];
|
|
>x : Symbol(C2.x, Decl(circularIndexedAccessErrors.ts, 24, 10))
|
|
|
|
y: this["z"];
|
|
>y : Symbol(C2.y, Decl(circularIndexedAccessErrors.ts, 25, 17))
|
|
|
|
z: this["x"];
|
|
>z : Symbol(C2.z, Decl(circularIndexedAccessErrors.ts, 26, 17))
|
|
}
|
|
|
|
// Repro from #12627
|
|
|
|
interface Foo {
|
|
>Foo : Symbol(Foo, Decl(circularIndexedAccessErrors.ts, 28, 1))
|
|
|
|
hello: boolean;
|
|
>hello : Symbol(Foo.hello, Decl(circularIndexedAccessErrors.ts, 32, 15))
|
|
}
|
|
|
|
function foo<T extends Foo | T["hello"]>() {
|
|
>foo : Symbol(foo, Decl(circularIndexedAccessErrors.ts, 34, 1))
|
|
>T : Symbol(T, Decl(circularIndexedAccessErrors.ts, 36, 13))
|
|
>Foo : Symbol(Foo, Decl(circularIndexedAccessErrors.ts, 28, 1))
|
|
>T : Symbol(T, Decl(circularIndexedAccessErrors.ts, 36, 13))
|
|
}
|
|
|