Skip to content

Commit 71ceea2

Browse files
andrewdelpretetmcw
authored andcommitted
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

Lines changed: 3 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy