You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Record type fail with circular reference error #35164
Search Terms:circularly references itself, Record circular reference
Code
typeRecursiveTypeA=Record<number,RecursiveTypeA>// error: Type alias 'RecursiveTypeA' circularly references itself.typeRecursiveTypeB=RecursiveTypeB[]// works finetypeRecursiveTypeC={[index: number]: RecursiveTypeC}// works fine
Expected behavior:
Record type should work like the third example that defines an object with number keys to the recursive value (the key type is irrelevant).
Actual behavior:
Only the Record type fail with circular reference
Activity
idoros commentedon Nov 18, 2019
Reading the original PR that introduced recursive type, I can see that this has already been discussed and is by design.