Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@svgr/core imports @svgr/babel-preset without specifying it as a dependency #781

Closed
emlai opened this issue Sep 29, 2022 · 1 comment · Fixed by #782
Closed

@svgr/core imports @svgr/babel-preset without specifying it as a dependency #781

emlai opened this issue Sep 29, 2022 · 1 comment · Fixed by #782

Comments

@emlai
Copy link
Contributor

emlai commented Sep 29, 2022

🐛 Bug Report

@svgr/core imports @svgr/babel-preset:

import type { Options as TransformOptions } from '@svgr/babel-preset'

but doesn't specify it as a dependency:

"dependencies": {
"@svgr/plugin-jsx": "^6.3.1",
"camelcase": "^6.2.0",
"cosmiconfig": "^7.0.1"
},
"devDependencies": {
"@types/svgo": "^2.6.3"
}

For the user, this causes the following error in node_modules/@svgr/core/dist/index.d.ts:

TS2307: Cannot find module '@svgr/babel-preset' or its corresponding type declarations.

and consequently Options is imported as type any.

This causes Config["template"] to have type any for the user (imported as import type { Config } from "@svgr/core";).

To Reproduce

-

Expected behavior

@svgr/core defines @svgr/babel-preset as a dependency (or other appropriate fix), so that Config["template"] has correct type instead of any.

Link to repl or repo (highly encouraged)

-

Run npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard

## System:
 - OS: macOS 12.6
 - CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
 - Memory: 1.73 GB / 32.00 GB
 - Shell: 5.8.1 - /bin/zsh
## Binaries:
 - Node: 16.16.0 - /usr/local/bin/node
 - Yarn: 1.22.19 - /usr/local/bin/yarn
 - npm: 8.11.0 - /usr/local/bin/npm
## npmPackages:
 - @svgr/core: 6.3.1 => 6.3.1 
@gregberge
Copy link
Owner

Hello @emlai, could submit a PR to fix it please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants