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

Identifier 'Svg' has already been declared #284

Closed
thibaultcapelli opened this issue Jul 27, 2023 · 6 comments
Closed

Identifier 'Svg' has already been declared #284

thibaultcapelli opened this issue Jul 27, 2023 · 6 comments

Comments

@thibaultcapelli
Copy link

thibaultcapelli commented Jul 27, 2023

I have this error when I upgrade to 1.1.0

  1 | import * as React from "react";
  2 | import Svg, { Path } from "react-native-svg";
> 3 | import type { SvgProps, Svg, Path } from "react-native-svg";
@pehagg
Copy link

pehagg commented Aug 1, 2023

I would encourage you to read the error message and your code again.

You can't import the same declarations twice, the typescript compiler will choke on this. Just use regular imports. Type imports are for more esoteric cases when you run into issues with transpilers. For a detailed description, see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export.

@thibaultcapelli
Copy link
Author

Hello @pehagg

I understand the error but the code is not mine. It provide from an SVG I import with this lib. I guess it is the transpiled code. I do not have this issue with the 1.0.0

@pehagg
Copy link

pehagg commented Aug 1, 2023

@thibaultcapelli , sorry, I missed the "when I upgrade" part. For context, have you upgraded any other libs in your project or is it this lib only?

@kristerkari
Copy link
Owner

kristerkari commented Aug 5, 2023

Looks like this is a possible bug in SVGR:
gregberge/svgr#891

@kristerkari
Copy link
Owner

Looks like there is a fix for it: gregberge/svgr#894

@kristerkari
Copy link
Owner

If you run into this problem, please check that your lockfile is using the 8.1.0 or newer version for the following react-native-svg-transformer dependencies:

@svgr/core
@svgr/plugin-jsx 
@svgr/plugin-svgo

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

No branches or pull requests

3 participants