-
-
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
Support Flow's proto modifier syntax for declared classes #7978
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/8207/ |
@@ -321,6 +321,7 @@ defineType("ObjectTypeProperty", { | |||
value: validateType("FlowType"), | |||
kind: validate(assertOneOf("init", "get", "set")), | |||
static: validate(assertValueType("boolean")), | |||
proto: validate(assertValueType("proto")), |
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.
boolean
?
Also, can we assert that the property isn't both statc and proto?
See facebook/flow@eb815be for more information about this feature. The proto modifier indicates that a property declared using `x: T` syntax is actually present on the prototype object of the class, rather than an own property. The proto and static modifiers are mutually exclusive, as class declarations don't simultaneously define the static prototype object, as they do the instance prototype. This syntax is only supported on declared classes, not object types, interfaces, or runtime class declarations, and as such should only appear in library definitions.
fe96b4e
to
3bdaee1
Compare
Rebased, and updated to assert @nicolo-ribaudo we can probably just follow up with both an exclusive assertion util and updating the builder? |
Flow commit: facebook/flow@eb815be Babel PR: babel/babel#7978
<!-- Before making a PR please make sure to read our contributing guidelines https://github.com/babel/babel/blob/master/CONTRIBUTING.md For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly. --> | Q | A <!--(Can use an emoji 👍) --> | ------------------------ | --- | Fixed Issues? | <!-- remove the (`) quotes to link the issues --> | Patch: Bug Fix? | | Major: Breaking Change? | No | Minor: New Feature? | Yes | Tests Added + Pass? | Yes | Documentation PR | <!-- If so, add `[skip ci]` to your commit message to skip CI --> | Any Dependency Changes? | | License | MIT See facebook/flow@eb815be for more information about this feature. The proto modifier indicates that a property declared using `x: T` syntax is actually present on the prototype object of the class, rather than an own property. The proto and static modifiers are mutually exclusive, as class declarations don't simultaneously define the static prototype object, as they do the instance prototype. This syntax is only supported on declared classes, not object types, interfaces, or runtime class declarations, and as such should only appear in library definitions.
See facebook/flow@eb815be for more information about this feature.
The proto modifier indicates that a property declared using
x: T
syntax is actually present on the prototype object of the class, rather than an own property.The proto and static modifiers are mutually exclusive, as class declarations don't simultaneously define the static prototype object, as they do the instance prototype.
This syntax is only supported on declared classes, not object types, interfaces, or runtime class declarations, and as such should only appear in library definitions.