Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Circularity error in intersection of object with index signature #38672

Copy link
Copy link
@ahejlsberg

Description

@ahejlsberg
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScript

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.