-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Recursive type alias in union type breaks in 3.8.3 #37344
Copy link
Copy link
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.8.3
Search Terms: recursive, recursion
Code
type Action<T, P> = P extends void ? { type : T } : { type: T, payload: P }
enum ActionType {
Foo,
Bar,
Baz,
Batch
}
type ReducerAction =
| Action<ActionType.Bar, number>
| Action<ActionType.Baz, boolean>
| Action<ActionType.Foo, string>
| Action<ActionType.Batch, ReducerAction[]>Expected behavior: compiler does not complain recursive type alias, works fine in 3.7.5
Actual behavior: compiler complains recursive type alias, breaks in 3.8.3
Type arguments for 'Array' circularly reference themselves.
Related Issues:
I'm not sure, if this might be related to #35017.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue