Closed
Description
π Search Terms
Circular Reference, Generic Parameterization, error TS2456: Type alias 'Result' circularly references itself.
π Version & Regression Information
Failing on Main 32ebd28
β― Playground Link
π» Code
Fails :-
type Any<T extends Object> = {
[key:string]: T;
};
type Result = string | Result[] | Any<Result>; // error TS2456: Type alias 'Result' circularly references itself.
Works :-
type ResultObject = {
[key:string]: Result;
};
type Result = string | Result[] | ResultObject;
Fails :-
type ResultObject = {
[key:string]: Result;
};
type ResultArray<T> = T[];
type Result = string | ResultArray<Result> | ResultObject; // error TS2456: Type alias 'Result' circularly references itself.
It looks like it is a Generic Parameterization issue.
π Actual behavior
Throwing Error on compilation error TS2456: Type alias 'Result' circularly references itself.
π Expected behavior
Should not throw an error and demonstrates the type system is incomplete.
Additional information about the issue
No response