Issue
I have created a custom select component that extends the HTML select element. I utilized a generic type to accommodate various data types, and I came across an unusual error. The error persists when I use <T,> with a comma, as shown here.
However, if i remove the comma, changing <T,> to , an error occurs everywhere, as shown here.
What causes this problem ?
Solution
there is nothing wrong with your code, whether with the comma or without
the comma in the generics is needed because otherwise there would be a collapse of 2 identical syntaxes in the tsx files
therefore, as a compromise, when you make a component that accepts only one generic, put the comma to make the parser understand that it is a generic and not a component
Answered By - Cosimo Chellini
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.