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

Support type guards in Flow #14767

Merged
merged 3 commits into from Apr 27, 2023
Merged

Support type guards in Flow #14767

merged 3 commits into from Apr 27, 2023

Conversation

panagosg7
Copy link
Contributor

@panagosg7 panagosg7 commented Apr 27, 2023

Description

This PR adds support for type guards in Flow as they appear in TypeScript (docs).

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

node.typeAnnotation
? [" is ", printTypeAnnotationProperty(path, print)]
: "",
];
Copy link
Member

Choose a reason for hiding this comment

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

Please extract code for TSTypePredicate print, and reuse it instead of copy it. For now we put them in type-annotation.js

Copy link
Member

@fisker fisker left a comment

Choose a reason for hiding this comment

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

LGTM, can merge when it's ready.

@panagosg7 panagosg7 marked this pull request as ready for review April 27, 2023 02:35
@fisker fisker merged commit 2eaf576 into prettier:main Apr 27, 2023
9 of 10 checks passed
@panagosg7
Copy link
Contributor Author

Thanks @fisker !

@panagosg7 panagosg7 deleted the type-guards branch April 27, 2023 16:08
medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Feb 15, 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.

None yet

2 participants