Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: 🐛 fixed duplicate react-native-svg duplicate import #894

Merged
merged 1 commit into from
Aug 15, 2023
Merged

fix: 🐛 fixed duplicate react-native-svg duplicate import #894

merged 1 commit into from
Aug 15, 2023

Conversation

MohammadKurjieh
Copy link
Contributor

This PR resolved #891

Summary

When updating the imports of react-native-svg there is no check on the importKind. This would cause a wrong update import and a crash in the cli. This bug occurs when combining expandProp, native and typescript in the config.

Current Output

import * as React from "react";
import Svg, { Path } from "react-native-svg";
//     ^^^   ^^^^^
import type { SvgProps, Svg, Path } from "react-native-svg";
//                      ^^^^^^^^^

Fixed Output

import * as React from "react";
import Svg, { Path } from "react-native-svg";
import type { SvgProps } from "react-native-svg";

Test plan

Run the cli with expandProp, native and typescript in the config. It used to crash and complain about duplicate imports.

Acknowledgement

Thanks to @atomicpages for their investigative work, it helped me track the bug.

When updating the imports of react-native-svg there is no check on the importKind. This would cause a wrong update import and a crash in the cli.
@vercel
Copy link

vercel bot commented Aug 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svgr ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 4, 2023 3:01am

@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Merging #894 (eed9ba1) into main (82928f0) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #894      +/-   ##
==========================================
+ Coverage   92.87%   92.89%   +0.01%     
==========================================
  Files          32       32              
  Lines         758      760       +2     
  Branches      253      251       -2     
==========================================
+ Hits          704      706       +2     
  Misses         53       53              
  Partials        1        1              
Files Changed Coverage Δ
...bel-plugin-transform-react-native-svg/src/index.ts 91.66% <100.00%> (+0.36%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@atomicpages
Copy link

@gregberge are you able to take a look at this PR? 🙏

@gregberge
Copy link
Owner

@gregberge are you able to take a look at this PR? 🙏

Yes but I didn't have time to release and merge it. Will do soon.

@gregberge gregberge merged commit e612b6a into gregberge:main Aug 15, 2023
11 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate type imports with expandProp + native + typescript
3 participants