fix flow-comment - object destructuring (#9893)

This commit is contained in:
Tan Li Hau
2019-04-27 04:22:41 +08:00
committed by Nicolò Ribaudo
parent 80a5a2e7dd
commit 71013088ef
5 changed files with 34 additions and 0 deletions

View File

@@ -127,6 +127,17 @@ export default declare(api => {
}
wrapInFlowComment(path, parent);
},
ObjectPattern(path) {
const { node } = path;
if (node.typeAnnotation) {
const typeAnnotation = path.get("typeAnnotation");
path.addComment(
"trailing",
generateComment(typeAnnotation, typeAnnotation.node),
);
typeAnnotation.remove();
}
},
Flow(path) {
const { parent } = path;