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 Flow "declare class" fully: type parameters, "extends", "implements" #1090

Merged
merged 2 commits into from
Sep 27, 2022

Conversation

gnprice
Copy link
Contributor

@gnprice gnprice commented Apr 27, 2022

And add test cases.

The first commit does this by basically copying from the "ClassDeclaration" case.

But there's so much in common between them -- it'd be nice to share most of this logic. Otherwise, as this breakage demonstrates, it's easy for one of them to lag behind in getting a feature the other has. So in the second commit, we unify the handling of "DeclareClass" (used for Flow "declare class …") with "ClassDeclaration" and "ClassExpression", which are already unified with each other.

The "implements" property on "DeclareClass" isn't yet known to ast-types -- I'll send a PR there for that. But it's already emitted by flow-parser, so the round-trip tests already work.

gnprice added a commit to gnprice/ast-types that referenced this pull request Apr 27, 2022
This is already produced by flow-parser to support Flow's
`declare class A implements B {}`.

At the moment it's ignored by the Recast printer, but I've sent a PR
to fix that, along with other features of `declare class`:
  benjamn/recast#1090
gnprice added a commit to gnprice/tsflower that referenced this pull request Apr 27, 2022
…ements".

This is basically copied from the "ClassDeclaration" case.
There's so much in common between them -- it'd be nice to share
most of this logic.
These have so much in common that when they're implemented separately,
it's easy (as the breakage fixed in the previous commit demonstrates)
for one of them to lag behind in getting a feature the other has.
@eventualbuddha eventualbuddha merged commit 9a22270 into benjamn:master Sep 27, 2022
@eventualbuddha
Copy link
Collaborator

Fixed in v0.21.5.

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.

2 participants