Skip to content

Circularity error in intersection of object with index signature #38672

Description

TypeScript Version: 4.0.0-dev

Code

type Foo1 = { x: string } & { [x: number]: Foo1 };    // Circularity error
type Foo2 = { x: string } & { [K in number]: Foo2 };  // No error

Expected behavior:

No errors.

Actual behavior:

Error: Type alias 'Foo1' circularly references itself.

Playground Link:

https://www.typescriptlang.org/play/index.html?ssl=1&ssc=1&pln=3&pc=1#code/C4TwDgpgBAYg9nAjFAvFA3lAHgLigZ2ACcBLAOwHMoBfKAMgygG1coyBXAWwCMIiBdPPCQ0A3FAlQA9FKgBhEkQDG7ADYBDUqCh8icIgChQkWAgBMqRq0KlKNeoyYBpKOTZdeAoebESZUADk4HSI9QyA

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions