Skip to content

Record type fail with circular reference error #35164

Closed
@idoros

Description

@idoros

TypeScript Version: 3.7.2 (and also nightly)

Search Terms: circularly references itself, Record circular reference

Code

type RecursiveTypeA = Record<number, RecursiveTypeA> // error: Type alias 'RecursiveTypeA' circularly references itself.

type RecursiveTypeB = RecursiveTypeB[] // works fine

type RecursiveTypeC = { [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

Playground Link: link

Related Issues: couldn't find any specific related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions