gilbarbara / react-inlinesvg

An SVG loader component for ReactJS

Home Page:https://codesandbox.io/s/github/gilbarbara/react-inlinesvg/tree/main/demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TS errors when importing

mnpqraven opened this issue · comments

commented

Describe the bug
In the new version of 'react-inlinesvg' the return type of the component contains undefined and will lead to typescript errors. I have my repo setup to cancel builds when there are typescript errors and therefore can't build with the current version of 'react-inlinesvg'. For now I've downgraded to 3.0.3 and it works without errors

image

Link to repl or repo (highly encouraged)
The errors can be seen at the example codesandbox

Hey @mnpqraven
You probably need to update your types.

Or your typescript version.
Codesandbox VS code editor uses typescript 4.x, but the bundler uses 5.x. That's why you see the errors in the editor, but it renders without issues.

commented

I've upgraded @types/react to the required version (^18.2.20 even). There's no longer errors in the editors but those errors will still appear during build and cancel build for me.
For context this is typescript 5 and on the latest version of nextjs

commented

I've managed to solve the errors during build by bumping typescript from 5.0.1 to 5.1.6. I think just ts 5 is not enough and you might still need a newer ts release.

@mnpqraven The library does not have TypeScript as a dependency. It uses the host app version.