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
This plugin incorrectly fixes the generics syntax for React components with a single type parameter (<T>).
For example: if you open a TypeScript + React project and create a MyComponent.tsx file with the following content:
typeMyComponentProps<T>={data: T;};functionMyComponent<T>({ data }: MyComponentProps<T>){return(<div>{/* JSX content */}</div>)};
When auto-fixing, you'll end up with:
typeMyComponentProps<T>={data: T;};constMyComponent=<T>({ data }: MyComponentProps<T>)=><div>{/* JSX content */}</div>;
This is not valid syntax, given that <T> in TSX is interpreted as an opening tag. To fix this, users must manually add a trailing comma to the type argument T, transforming it into <T,>.
Recording.2024-01-21.151114.mp4
Suggested Solution
Automatically add the trailing comma if the error is being fixed on a .tsx file.
Help Needed
I can try to work on this if we get #25 and #26 going, don't want to stack too many requests 😅
The text was updated successfully, but these errors were encountered:
Description
This plugin incorrectly fixes the generics syntax for React components with a single type parameter (
<T>
).For example: if you open a TypeScript + React project and create a
MyComponent.tsx
file with the following content:When auto-fixing, you'll end up with:
This is not valid syntax, given that
<T>
in TSX is interpreted as an opening tag. To fix this, users must manually add a trailing comma to the type argumentT
, transforming it into<T,>
.Recording.2024-01-21.151114.mp4
Suggested Solution
Automatically add the trailing comma if the error is being fixed on a
.tsx
file.Help Needed
I can try to work on this if we get #25 and #26 going, don't want to stack too many requests 😅
The text was updated successfully, but these errors were encountered: