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

fix(replaceType): handle array syntax #455

Merged
merged 3 commits into from
Dec 13, 2024

Conversation

henryqdineen
Copy link
Contributor

This PR fixes an issue that we encountered running the React 19 codemods that would result in incorrect types like:

- children?: ReactChild[];
+ children?: ReactElement | number | string[];

I'm not sure if it's actually a bug in the recast printer but I think the solution here makes sense. We check if the parent is a TSArrayType and add parenthesis add a TSParenthesizedType wrapper if appropriate.

Copy link

changeset-bot bot commented Dec 10, 2024

🦋 Changeset detected

Latest commit: 4def217

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
types-react-codemod Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Owner

@eps1lon eps1lon 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!

@eps1lon eps1lon merged commit 70a1ea5 into eps1lon:main Dec 13, 2024
3 checks passed
@github-actions github-actions bot mentioned this pull request Dec 13, 2024
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.

2 participants