-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 inline interfaces #4543
Conversation
src/language-js/printer-estree.js
Outdated
@@ -2485,6 +2485,26 @@ function printPathNoParens(path, options, print, args) { | |||
path.call(print, "id"), | |||
path.call(print, "typeParameters") | |||
]); | |||
|
|||
case "InterfaceType": | |||
case "InterfaceTypeAnnotation": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to combine this with the TS one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hesitant initially, since they can't have an id
or typeParameters
, but I went ahead and merged it with the logic for printing flow's DeclareInterface
and InterfaceDeclaration
.
fec99c5
to
a623d04
Compare
We landed a change that added a new `InterpreterDirective` AST node type for hashbangs, and no longer add it as a comment/leadingComment. Ref: babel/babel#7928 I mimicked what we do in `@babel/generator` here, since I found it better than trying to add comments to the ast in `parser-include-shebang.js`). Definitely open to a better/cleaner option though! Note: I'll follow this up with enabling tests for #4543 and #4540 once they land too.
Flow commit: facebook/flow@4f93f3a
Babel commit: babel/babel#7973
Will follow up w/ flow team on making
InterfaceType
->InterfaceTypeAnnotation
, since it seems a bit inconsistent.