docs: hide literal union variants (#9347)

This commit is contained in:
Bobbie Soedirgo committed 2022-10-05 20:31:31 +08:00
1 parent ab9ed4e41c
commit c760942903
1 file changed
+8 -2
+8 -2
View File
@@ -130,8 +130,14 @@ function recurseThroughParams(paramDefinition: TsDoc.TypeDefinition) {
if (param.type?.declaration?.children) {
children = param.type?.declaration?.children
} else if (isUnion(param)) {
// children = param.type.types
children = null // We don't want to show the union types
// We don't want to show the union types if it's a literal
const nonLiteralVariants = param.type.types.filter(({ type }) => type !== 'literal')
if (nonLiteralVariants.length === 0) {
children = null
} else {
children = nonLiteralVariants
}
} else if (param.type === 'reflection') {
children = param.declaration.children
}