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

Add support for Flow's IndexedAccessType #478

Closed
pascalduez opened this issue Jan 20, 2022 · 6 comments
Closed

Add support for Flow's IndexedAccessType #478

pascalduez opened this issue Jan 20, 2022 · 6 comments
Labels

Comments

@pascalduez
Copy link

pascalduez commented Jan 20, 2022

Currently [email protected] choke on Flow's indexed access types.

Error: did not recognize object of type "IndexedAccessType"

It should be "just" a matter of updating recast, which comes with ast-types.
Support for IndexedAccessType was added as of [email protected].

EDIT: as of today, both [email protected] and [email protected] are not published on the latest tag, but next.

/cc @benjamn

@pascalduez
Copy link
Author

Thanks @gkz for the update on master.

I tried with this jscodeshift version (git), and the IndexedAccessType errors are gone.

But now it's choking on:
did not recognize object of type "QualifiedTypeofIdentifier"
did not recognize object of type "PropertyDefinition"
Which is weird since they are not new type syntax.
🤷‍♀️

@gkz
Copy link
Member

gkz commented Jan 21, 2022

Thanks for the report. When people make changes to our AST output, sometimes ast-types is not updated as well.

If you want you can use yarn resolutions to resolve ast-types to @gkz/ast-types. We are currently using this in combination with flow-parser 0.152 for jscodeshift and it works for us. The ast-types package is very slowly updated unfortunately.

@pascalduez
Copy link
Author

pascalduez commented Jan 24, 2022

For reference to other potential FLow users:

Yarn

"resolutions": {
    "**/ast-types": "npm:@gkz/ast-types",
    "**/flow-parser": "0.152"
  }

Npm

"overrides": {
    "ast-types": "npm:@gkz/ast-types",
    "flow-parser": "0.152"
},

Downside, yarn link doesn't works for CLIs...

@gkz
Copy link
Member

gkz commented Feb 10, 2023

Actual ast-types package now includes support for IndexedAccessTypes

@gkz gkz closed this as completed Feb 10, 2023
@pascalduez
Copy link
Author

I tried removing the overrides and all the errors are back. So I guess the whole chain transitive is not up to date or fixed yet.

@seansfkelley
Copy link

Apologies for the tangent on a closed issue, but this is currently the highest relevant search result for QualifiedTypeofIdentifier and PropertyDefinition errors. If you encounter those, you can install the ast-types fork defining PropertyDefinition from benjamn/ast-types#727. (There's no PR I see for QualifiedTypeofIdentifier, and I don't actually know or care what these node types look like so I haven't offered my hacky fork as a PR.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants