-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Fix private property parsing in Flow #8340
Fix private property parsing in Flow #8340
Conversation
kalenikalexander
commented
Jul 18, 2018
Q | A |
---|---|
Fixed Issues? | Parse private class properties with Flow types |
Patch: Bug Fix? | Yes |
Major: Breaking Change? | No |
Minor: New Feature? | No |
Tests Added + Pass? | Yes |
Documentation PR Link | No |
Any Dependency Changes? | No |
License | MIT |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/8745/ |
@@ -0,0 +1,4 @@ | |||
class A { |
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 know we do a really bad job of it, but can we give this folder a name? Maybe class-private-property
or something?
We might also want to make a note to bump https://github.com/babel/babel/blob/master/Makefile#L2 to make sure we're syncing with flow's parsing of private props. |
I added |
Hey, what's the status here? This seems to be the last bit necessary to make private properties work nicely when using Flow. |
packages/babel-parser/src/types.js
Outdated
@@ -716,6 +716,7 @@ export type ClassPrivateProperty = NodeBase & { | |||
value: ?Expression, // TODO: Not in spec that this is nullable. | |||
static: boolean, | |||
computed: false, | |||
typeAnnotation?: ?TypeAnnotationBase, // TODO: Not in spec |
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.
Shouldn't this type be TypeAnnotation
?
Parsing looks good, should we also add tests to Can also land this now and follow up. |
I should put |
@kalenikalexander let’s do strip-types |
Thank you! |
* Fix private property parsing in Flow * Flow tests updated * Fix type error * Appropriate name was given to test folder * Fix * Empty * Correct type annotation * Add required changes in generator package * Add required changes in flow-strip-types