You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a parsing ambiguity in TS, sometimes it doesn't know if <T> is JSX or a type parameter.
The recommendation is to give a TS a clue with <T extends any> or <T, >, see microsoft/TypeScript#15713.
dprint removes the additional comma, which makes TS think its the start of a JSX expression and thus it leads to a type error.
This only happens in .tsx files and could possibly be related to #265 (or not related at all, haha).
This bug is more than a simple formatting issue, as formatting breaks Typechecking/transpilation in this particular case.
dprint-plugin-typescript version: 0.51.0
Possible workaround
Change <T, > to <T extends any> which is formatted safely
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
There's a parsing ambiguity in TS, sometimes it doesn't know if
<T>
is JSX or a type parameter.The recommendation is to give a TS a clue with
<T extends any>
or<T, >
, see microsoft/TypeScript#15713.dprint removes the additional comma, which makes TS think its the start of a JSX expression and thus it leads to a type error.
This only happens in
.tsx
files and could possibly be related to #265 (or not related at all, haha).This bug is more than a simple formatting issue, as formatting breaks Typechecking/transpilation in this particular case.
dprint-plugin-typescript version: 0.51.0
Possible workaround
Change
<T, >
to<T extends any>
which is formatted safelyInput Code
Expected Output
Actual Output
(bit hard to see, note the removal of
,
)cc @WearyMonkey
The text was updated successfully, but these errors were encountered: