Open
Description
As an example, in this challenge: src/05-generics/39-generic-props.problem.tsx
.
This happens in all challenges involving a single unconstrained type argument in a TSX file (which admittedly doesn't happen extremely often).
We need to add a comma after the T
, like this:
-export const Table = (props: TableProps) => {
+export const Table = <T,>(props: TableProps<T>) => {
However, when saving the file in StackBlitz Prettier removes the ,
, making the file invalid:
-export const Table = <T,>(props: TableProps<T>) => {
+export const Table = <T>(props: TableProps<T>) => {
Luckily, the optional way of doing this with T extends unknown
works here:
-export const Table = <T,>(props: TableProps<T>) => {
+export const Table = <T extends unknown>(props: TableProps<T>) => {
This should have been fixed in Prettier in 2019 though, so I'm not sure why this would be happening here: prettier/prettier#6114
Metadata
Metadata
Assignees
Labels
No labels