TypeScript generics on React components falsely recognized as JSX

I have a React/TypeScript project and I'm trying to make a component that accepts a generic/type argument, but WebStorm seems to always recognize any `<` or `>` as being part of a JSX element. This means that when I use `<T>` to define a type argument, WebStorm thinks I'm trying to write a JSX element and raises a false error.


Here's an article showing that this should work.


this is a known Typescript limitation, see https://github.com/microsoft/TypeScript/issues/15713#issuecomment-300545248

as a workaround, try changing arrow function to function expression


Elena Pogorelova Thank you that works.

However in the article I linked, he uses an arrow function just fine but that github issue is even older than the article. I've seen other examples online showing this working with arrow functions too.


can't comment on the article; the github issue is still actual, feel free to add your comments to it


Please sign in to leave a comment.