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: TSArrayType printer when element is a TSUnionType #1416

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henryqdineen
Copy link
Contributor

When a TSUnionType has an elementType of TSUnionType the brackets would only end up on the last member of the union (e.g number | string[] instead of (number | string)[]). Parsers seem to wrap the TSUnionType in a TSParenthesizedType which would get around this issue but in codemods and other scenarios where nodes are built by hand it could be easy to make this mistake.

It's possible that this is just a bug in ast-types and a TSUnionType should not be a valid elementType.

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.

1 participant