mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
69 lines
2.7 KiB
Plaintext
69 lines
2.7 KiB
Plaintext
circularIndexedAccessErrors.ts(2,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
|
circularIndexedAccessErrors.ts(11,11): error TS2589: Type instantiation is excessively deep and possibly infinite.
|
|
circularIndexedAccessErrors.ts(18,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
|
circularIndexedAccessErrors.ts(22,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
|
circularIndexedAccessErrors.ts(26,5): error TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor.
|
|
circularIndexedAccessErrors.ts(27,5): error TS2564: Property 'y' has no initializer and is not definitely assigned in the constructor.
|
|
circularIndexedAccessErrors.ts(28,5): error TS2564: Property 'z' has no initializer and is not definitely assigned in the constructor.
|
|
circularIndexedAccessErrors.ts(37,24): error TS2313: Type parameter 'T' has a circular constraint.
|
|
circularIndexedAccessErrors.ts(37,30): error TS2536: Type '"hello"' cannot be used to index type 'T'.
|
|
|
|
|
|
==== circularIndexedAccessErrors.ts (9 errors) ====
|
|
type T1 = {
|
|
x: T1["x"]; // Error
|
|
~
|
|
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
|
};
|
|
|
|
type T2<K extends "x" | "y"> = {
|
|
x: T2<K>[K]; // Error
|
|
y: number;
|
|
}
|
|
|
|
declare let x2: T2<"x">;
|
|
let x2x = x2.x;
|
|
~~~~
|
|
!!! error TS2589: Type instantiation is excessively deep and possibly infinite.
|
|
|
|
interface T3<T extends T3<T>> {
|
|
x: T["x"];
|
|
}
|
|
|
|
interface T4<T extends T4<T>> {
|
|
x: T4<T>["x"]; // Error
|
|
~
|
|
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
|
}
|
|
|
|
class C1 {
|
|
x: C1["x"]; // Error
|
|
~
|
|
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
|
}
|
|
|
|
class C2 {
|
|
x: this["y"];
|
|
~
|
|
!!! error TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor.
|
|
y: this["z"];
|
|
~
|
|
!!! error TS2564: Property 'y' has no initializer and is not definitely assigned in the constructor.
|
|
z: this["x"];
|
|
~
|
|
!!! error TS2564: Property 'z' has no initializer and is not definitely assigned in the constructor.
|
|
}
|
|
|
|
// 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'.
|
|
}
|
|
|