Skip to content

<key> is referenced directly or indirectly in its own type annotation #22018

Description

@KiaraGrouwstra

TypeScript Version: 2.8.0-dev.20180217

Search Terms:

  • "is referenced directly or indirectly in its own type annotation"

Code

type Flatten<T> = {
  '1': Flatten<T extends Array<infer U> ? U : T>;
}[T extends number ? '1' : '1'];

(as mentioned in #21613)

Expected behavior: ok

Actual behavior:

error TS2502: ''1'' is referenced directly or indirectly in its own type annotation.

Playground Link: needs 2.8, playground is on 2.7

Related Issues: #6230

I saw similar issues on other types, though the greatest common denominator appeared to be recursion + conditional types (?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions