-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: master
Search Terms:
Code
type StrictExtract<T, U> = T extends U ? U extends T ? T : never : never;
type StrictExclude<T, U> = T extends StrictExtract<T, U> ? never : T;
type A<T> = { [Q in { [P in keyof T]: P; }[keyof T]]: T[Q]; };
type B<T, V> = A<{ [Q in keyof T]: StrictExclude<B<T[Q], V>, {}>; }>;Expected behavior:
pass
Actual behavior:
$ node built/local/tsc.js --noEmit index.ts
index.ts:3:21 - error TS2313: Type parameter 'Q' has a circular constraint.
3 type A<T> = { [Q in { [P in keyof T]: P; }[keyof T]]: T[Q]; };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index.ts:4:36
4 type B<T, V> = A<{ [Q in keyof T]: StrictExclude<B<T[Q], V>, {}>; }>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Circularity originates in type at this location.
Found 1 error.
Playground Link:
Related Issues:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue