Skip to content

Commit 71ceea2

Browse files
andrewdelpretetmcw
authored andcommittedJun 4, 2020
refactor: 💡 type section is redundant and not formatted
When an object is flow typed, a `type` AND `properties` section is rendered. The type section seems redundant and isn't formatted, whereas the properties section is. This PR removes the `type` section when dealing with an object type. ✅ Closes: #1326
1 parent 01b1c2e commit 71ceea2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/infer/type.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ function inferType(comment) {
6464
type = ast.node.value;
6565
}
6666
}
67-
if (type) {
67+
// Don't provide a `type` section when it's an ObjectTypeAnnotation,
68+
// `properties` already exists and renders better.
69+
if (type && type.type !== 'ObjectTypeAnnotation') {
6870
comment.type = typeAnnotation(type);
6971
}
7072
return comment;

0 commit comments

Comments
 (0)
Please sign in to comment.