-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Labels
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
Prettier 2.8.3
Playground link
--parser typescript
Input:
type Test<T> = T extends ((
token: TSESTree.Token
) => token is infer U extends TSESTree.Token)
? U
: TSESTree.Token;
Output:
type Test<T> = T extends (
token: TSESTree.Token
) => token is infer U extends TSESTree.Token
? U
: TSESTree.Token;
Expected behavior:
The parentheses should be retained as they are required.
Without the parentheses it causes a syntax error:
SyntaxError: '?' expected. (5:19)
3 | ) => token is infer U extends TSESTree.Token
4 | ? U
> 5 | : TSESTree.Token;
| ^
6 |
JoshuaKGoldberg
Metadata
Metadata
Assignees
Labels
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.