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

Updates defs to not use deprecated * type, and rename $Partial to… #4432

Merged
merged 1 commit into from Apr 17, 2023

Conversation

gkz
Copy link
Contributor

@gkz gkz commented Apr 15, 2023

The * has been deprecated and just any since version 0.163. It became an error in all cases in version 0.204
$Partial was renamed to Partial in version 0.201, it was completely removed in version 0.203: https://medium.com/flow-type/announcing-partial-required-flow-utility-types-catch-annotations-3a32f0bf2a20

Update various definitions for this change:
For all definitions which had a vXXX.x- version range, I updated it to be vXXX.x-0.200.x, and copied the previous one to v0.201.x-
Then I codemoded these new v0.201.x- folders only
0.201 was also the point LTI became the only option, so good point for a cutoff.

Please check over my changes and make sure they make sense (e.g. folder moves/changes)! I have not contributed much to flow-typed before.

Used this transform to update the definitions:

function transformer(file, api) {
  const j = api.jscodeshift;

  return j(file.source)
    .find(j.ExistsTypeAnnotation)
    .forEach(path => {
      j(path).replaceWith(
        j.anyTypeAnnotation
      );
    })
    .toSource();
}
transformer.parser = 'flow';
module.exports = transformer;

Some commands I used (notes for myself later):

# `*` type
jscodeshift --parser=flow -t transform.js .
git st -s | cut -c '4-' | ag --only '^.*\-/' | sed 's/.$//' | sort | uniq > files
# revert changes
cat files | while read line; do cp -r "$line" "$(echo $line | sed -E 's/flow_v0.[0-9]{,3}/flow_v0.201/')"; git mv "$line" "$(echo $line)v0.200.x"; done
ag -g 201 | jscodeshift --stdin --parser=flow -t transform.js

# partial
ag -l '\$Partial' | ag --only '^.*\-/' | sed 's/.$//' | sort | uniq > partial-files
cat partial-files | while read line; do cp -r "$line" "$(echo $line | sed -E 's/flow_v0.[0-9]{,3}/flow_v0.201/')"; git mv "$line" "$(echo $line)v0.200.x"; done
ag -g 201 | sed -i 's/\$Partial</Partial/g'

@Brianzchen Brianzchen merged commit 9a968c6 into flow-typed:master Apr 17, 2023
2 of 4 checks passed
@pascalduez
Copy link
Member

pascalduez commented Apr 18, 2023

Sorry for not reviewing earlier, but there's an error in the file naming. flow_v0.104.x-v.200.x

-flow_v0.104.x-v.200.x
+flow_v0.104.x-v0.200.x

So we can't install anything anymore from master:

!! No flow@v0.184.0-compatible libdefs found in flow-typed for the explicitly requested libdefs. !!

@gkz
Copy link
Contributor Author

gkz commented Apr 18, 2023

Working on a fix

Brianzchen added a commit that referenced this pull request Apr 18, 2023
* Updates defs to not use deprecated `*` type, and rename `$Partial` to `Partial` (#4432)

* Fix names of dirs: "v.200.x" -> "v0.200.x" (#4435)

* delete overlaps

---------

Co-authored-by: George Zahariev <1222691+gkz@users.noreply.github.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.

None yet

3 participants