using react v18 with Typescript < v5.1, while allowing string as valid JSX Element
Full reproducible repo is https://github.com/Liooo/vite-project, just run yarn install && yarn tsc
to see the error.
react v18 with Typescript < v5.1 raises TS2786 'string' is not a valid JSX element
I want to use react v18 with Typescript < v5.1, but tsc raises error TS2786 'MyComponent' cannot be used as a JSX component. Its return type 'string' is not a valid JSX element.
like below:
@types/react v18 with Typescript < v5.1 raises TS2786 'string' is not a valid JSX element
I want to use react v18 with Typescript < v5.1, but tsc raises error TS2786 'MyComponent' cannot be used as a JSX component. Its return type 'string' is not a valid JSX element.
like below: