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

Generate typescript for SVGs when using svgr and typescript option #8411

Merged
merged 13 commits into from Sep 7, 2022

Conversation

samjt
Copy link
Contributor

@samjt samjt commented Aug 23, 2022

↪️ Pull Request

Generate typescript using SVGR's typescript:true option in svgrrc.json
SVGR can generate typescript as well as plain javascript react components, but the option throws an error in Parcel because the input in the transformer is hard coded to jsx.

Fixes #8376
Related: #7741

🚨 Test instructions

Included integration tests svg-react-typescript use a .svgrrc.json file and a package.json to transform to tsx and generate types based on the interface defined in react.ts

run yarn test:integration --grep 'SVG' to get the specific tests run

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

@samjt samjt changed the title Generate typescript for SVGs when using svgr and @parcel/ Generate typescript for SVGs when using svgr and typescript option Aug 23, 2022
@samjt
Copy link
Contributor Author

samjt commented Aug 23, 2022

@mischnic changes ready, thanks for the review

@samjt samjt requested a review from mischnic August 23, 2022 17:01
@mischnic
Copy link
Member

The lint check is complaining that packages/transformers/svg-react/src/SvgReactTransformer.js should be reformatted with prettier.

samjt and others added 2 commits August 23, 2022 22:14
Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
@samjt samjt requested a review from mischnic August 23, 2022 20:20
samjt and others added 2 commits August 24, 2022 13:17
Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
@samjt samjt requested a review from mischnic August 24, 2022 11:20
@samjt
Copy link
Contributor Author

samjt commented Aug 24, 2022

Sorry, a lot of back and forth on chores…

@samjt
Copy link
Contributor Author

samjt commented Aug 31, 2022

@mischnic I think this is all ready to merge

Copy link
Member

@mischnic mischnic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@mischnic mischnic merged commit 1572df0 into parcel-bundler:v2 Sep 7, 2022
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 this pull request may close these issues.

Standard SVG transform pipeline doesn't understand Typescript
2 participants