svgr
svgr copied to clipboard
Module '"svgo"' has no exported member 'OptimizeOptions'
🐛 Bug Report
When using this library and running the type checker, I get this error:
../../common/temp/node_modules/.pnpm/@[email protected]/node_modules/@svgr/core/dist/index.d.ts:2:10 - error TS2305: Module '"svgo"' has no exported member 'OptimizeOptions'.
2 import { OptimizeOptions } from 'svgo';
~~~~~~~~~~~~~~~
Found 1 error in ../../common/temp/node_modules/.pnpm/@[email protected]/node_modules/@svgr/core/dist/index.d.ts:2
I've tried forcing versions 2.8.0 and 3.0.2 of svgo
and I get the same error in both cases. It seems that possibly @types/svgo
has this OptimizeOptions
type, but that package is deprecated now: https://www.npmjs.com/package/@types/svgo
Run npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard
Paste the results here:
*** Clipboard option removed - use clipboardy or clipboard-cli directly ***
## System:
- OS: Windows 10 10.0.22621
- CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
- Memory: 4.04 GB / 15.71 GB
## Binaries:
- Node: 16.19.0 - C:\Program Files\Node.js\node.EXE
- npm: 9.2.0 - C:\Program Files\Node.js\npm.CMD
## npmPackages:
- @svgr/webpack: 5.5.0 => 5.5.0
@TrySound any idea?
Just ran into this, too.
Looks like svgo
isn't listed in the dependencies at all, and this may only work locally because you've included @types/svgo
in your devDependencies
.
https://github.com/gregberge/svgr/blob/main/packages/core/package.json#L48
To ship the type you could duplicate the definition, or just change it to be a normal dependency
(I don't know anything about these packages so apologies if this is unrelated)
I think the latest version (8.0.0) fixes all the annoying TypeScript issues I've had with this package. If you upgrade to the latest versions of @svgr/core
and svgo
all the type issues seem to resolve themselves.
I think svgo should be a normal dependency (not dev). That should also fix #904