-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Nested type assertions in JS code are broken #7775
Copy link
Copy link
Closed
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentslang:javascriptIssues affecting JSIssues affecting JSlocked-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.
Metadata
Metadata
Assignees
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentslang:javascriptIssues affecting JSIssues affecting JSlocked-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.
Prettier 1.19.1
Playground link
When using type assertions, TypeScript sometimes requires an intermediate cast to
unknowndue to a lack of significant overlap between types.Prettier’s formatting currently breaks this intermediate JSDoc‑based type assertion.
Input:
Note:
BarImplis wrapped by aProxylater in the code, which takes care of the actualapplyandconstructcalls, but that’s irrelevant to this issue.Output:
Expected behavior: