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 for Flow's Optional Indexed Access type #10788

Merged
merged 1 commit into from May 3, 2021

Conversation

gkz
Copy link
Contributor

@gkz gkz commented Apr 29, 2021

Description

This adds support for Flow's "Optional Indexed Access Types" (e.g type T = Obj?.[K]), a follow on to the support for "Indexed Access Types" added in #10594

Checklist

  • I’ve added tests to confirm my change works.
  • (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

@gkz gkz force-pushed the flow-optional-indexed-access branch 2 times, most recently from a839e34 to 9b8dee5 Compare April 29, 2021 23:52
@gkz
Copy link
Contributor Author

gkz commented Apr 30, 2021

Failure doesn't look related.

@@ -0,0 +1 @@
run_spec(__dirname, ["flow"], { trailingComma: "all" });
Copy link
Member

Choose a reason for hiding this comment

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

babel-flow doesn't support it, correct?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe Babel 7.14.0 supports it, but we haven't updated yet

Copy link
Member

Choose a reason for hiding this comment

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

If that's true, better update babel first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Babel 7.14.0 does support it (https://github.com/babel/babel/releases/tag/v7.14.0), didn't realize it had released (happened just today)

Copy link
Member

Choose a reason for hiding this comment

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

However probably just update to 7.14, tests will be failed. Because almost error messages thrown by babel/parser are updated.

Copy link
Member

Choose a reason for hiding this comment

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

I'll create PR to update babel/parser

Copy link
Member

Choose a reason for hiding this comment

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

I'm not doing anything now, I can try.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I've created #10802

Copy link
Member

Choose a reason for hiding this comment

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

I was busy... suddenly

@gkz gkz force-pushed the flow-optional-indexed-access branch 2 times, most recently from c0b0ac8 to 29e229e Compare April 30, 2021 18:12
@gkz gkz force-pushed the flow-optional-indexed-access branch from 29e229e to 2897faa Compare April 30, 2021 18:27
@gkz
Copy link
Contributor Author

gkz commented Apr 30, 2021

If there are issues with the Babel upgrade, we can merge this PR and just add babel-flow to this test (and also the tests/format/flow/indexed-access test) in the Babel PR when it's ready.

Copy link
Member

@sosukesuzuki sosukesuzuki left a comment

Choose a reason for hiding this comment

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

We can support indexed access type syntax by babel-flow after #10802 is merged. So this PR looks good to me.

@sosukesuzuki
Copy link
Member

sosukesuzuki commented May 3, 2021

@fisker I'll merge this for now, if you have another review points please let me know.

@sosukesuzuki sosukesuzuki merged commit 1bcaf61 into prettier:main May 3, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants