Skip to content

Print as instead of : for babel-ts parser#12706

Merged
fisker merged 6 commits intoprettier:mainfrom
HosokawaR:fix-10635
Apr 27, 2022
Merged

Print as instead of : for babel-ts parser#12706
fisker merged 6 commits intoprettier:mainfrom
HosokawaR:fix-10635

Conversation

@HosokawaR
Copy link
Copy Markdown
Contributor

@HosokawaR HosokawaR commented Apr 27, 2022

Description

fix: #10635

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

Comment on lines +58 to +60
if (parentNode.type === "ArrayPattern" && options.parser === "babel-ts") {
return [" as ", print("typeAnnotation")];
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ideally we should fix this in babel-parser side, but this seems to be work well as temporary fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Has this been reported?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@fisker fisker merged commit 9fbdcda into prettier:main Apr 27, 2022
medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Jan 4, 2024
Co-authored-by: fisker Cheung <lionkay@gmail.com>
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.

as in array destructuring is printed wrong (babel-ts only)

3 participants