strothj / react-app-rewire-typescript-babel-preset

Add TypeScript support to Create React App using @babel/preset-typescript
https://react-app-rewire-typescript-babel-preset.netlify.com
MIT License
52 stars 6 forks source link

Typings for svg files given on the installation docs throws an error #23

Closed GabeDuarteM closed 6 years ago

GabeDuarteM commented 6 years ago

The current typings for SVG files given on the installation docs are actually giving me a [ts] Generic type 'SVGAttributes<T>' requires 1 type argument(s). error on vscode.

This is probably because, using the latest typings, React.SVGAttributes expect a generic argument (probably SVGSVGElement, but not too sure about that).

There is an open PR on create-react-app to add support to Typescript, and looking through the code, we can find their typing file, which includes jpg and png files as well. Maybe we could replace the current typings with those?

By the way, I'm using the following versions:

"@types/react": "^16.4.13",
"@types/react-dom": "^16.0.7"
strothj commented 6 years ago

Thanks for the call out. I had a goofy setting set in tsconfig.json which prevented this error from surfacing. I've updated the docs and examples to match.