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

flow [nfc]: Convert $PropertyType and $ElementType to indexed-access syntax #5406

Merged
merged 2 commits into from
Jun 10, 2022

Conversation

gnprice
Copy link
Member

@gnprice gnprice commented Jun 9, 2022

Such a nicer syntax! This is available to us now that we've
upgraded Prettier:
#5393 (comment)
and Flow before that:
#5398 (comment)

Leave in place a number of uses of $ElementType in TsFlower output.
The right way to update those will be for TsFlower to switch to
emitting the new syntax.

gnprice added 2 commits June 9, 2022 15:42
Such a nicer syntax!  This is available to us now that we've
upgraded Prettier:
  zulip#5393 (comment)
and Flow before that:
  zulip#5398 (comment)

We'll similarly convert $ElementType in the next commit.

Done mostly with a crude search-and-replace:

    $ perl -i -0pe '
          s/\$PropertyType<(.*?),\s*(.*?)>/${1}[$2]/gs
        ' src/**/*.js types/**.js.flow flow-typed/**/*.js

That doesn't behave right in the presence of nesting; but there was
only one case of that, so just fixed it up by hand.
For the same reasons as for $PropertyType in the preceding commit.

Done mostly with another crude search-and-replace:

    $ perl -i -0pe '
          s/\$ElementType<(.*?),\s*(.*?)>/($1)[$2]/gs
        ' src/**/*.js

Then manually fixed the only place that got wrong, plus the spot in
types/react-intl.js.flow it would have gotten wrong.

Leave in place a number of uses of $ElementType in TsFlower output.
The right way to update those will be for TsFlower to switch to
emitting the new syntax.
@gnprice gnprice added the a-tools label Jun 9, 2022
@chrisbobbe chrisbobbe merged commit 5c0fc43 into zulip:main Jun 10, 2022
@chrisbobbe
Copy link
Contributor

Yay, thanks! LGTM; merged.

@gnprice gnprice deleted the pr-indexed-access-types branch June 10, 2022 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants