-
-
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
transform-flow-strip-types removes all jsdoc comments. #6898
Comments
Hey @ozum! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
Are you sure that it's You can see test for your case: |
It's because that comment is attatched to the tpe declaration node, which is removed. |
@Arfey, I'm sure it's from @nicolo-ribaudo, yes it is a type declaration comment, but not a flow comment. As @Arfey said, only comments that includes Without regular JS// @flow
/**
* Description of type
* @typedef {Object} SomeType
* @property {string} name - name
*/
export type SomeType = {| name: string |}; is transpiled to "use strict";
//# sourceMappingURL=fields.js.map With regular JS// @flow
/**
* Description of type
* @typedef {Object} SomeType
* @property {string} name - name
*/
export type SomeType = {| name: string |};
1; is transpiled to: "use strict";
1;
/**
* Description of type
* @typedef {Object} SomeType
* @property {string} name - name
*/
//# sourceMappingURL=fields.js.map |
Hmm, this is a tough one. We probably can address this with special logic if we decide to, but no matter what you'll kind of be walking a fine line. We don't generally guarantee that comments will pass through as-is, for Babel transforms because our parsed representation isn't exact for comments. |
Closing, out of scope for now. |
This is a bug report.
babel-plugin-transform-flow-strip-types
removes alljsdoc
comments, if source file contains onlyflowtype
code and no regular javascript. When there is some regular javascript code i.e.const a = 1
, jsdoc comments are preserved.Input Code
Babel/Babylon Configuration (.babelrc, package.json, cli command)
Expected Behavior
Current Behavior
Possible Solution
Comments should be preserved, even there is no js code.
Context
I'm using
flow
for static type checking andjsdoc
for documentation purposes. Sincebabel-plugin-transform-flow-strip-types
removes all jsdoc comments, documentation affected negatively.Your Environment
The text was updated successfully, but these errors were encountered: