docs-util: collapse types in references (#11888)
* docs-util: collapse types in references * improve for arrays
This commit is contained in:
@@ -108,14 +108,27 @@ export function getReflectionTypeParameters({
|
||||
return
|
||||
}
|
||||
|
||||
const reflectionTypeParameters = getReflectionTypeParameters({
|
||||
reflectionType: reflectionTypeArg,
|
||||
project,
|
||||
level: level + 1,
|
||||
maxLevel,
|
||||
isReturn: false,
|
||||
})
|
||||
|
||||
if (
|
||||
typeArgs.length === 1 &&
|
||||
reflectionTypeArg.type === "reference" &&
|
||||
reflectionTypeParameters.length === 1
|
||||
) {
|
||||
componentItem[parentKey - 1].children?.push(
|
||||
...(reflectionTypeParameters[0].children || [])
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
componentItem[parentKey - 1].children?.push(
|
||||
...getReflectionTypeParameters({
|
||||
reflectionType: reflectionTypeArg,
|
||||
project,
|
||||
level: level + 1,
|
||||
maxLevel,
|
||||
isReturn: false,
|
||||
})
|
||||
...reflectionTypeParameters
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -172,11 +185,20 @@ export function getReflectionTypeParameters({
|
||||
const elementTypeItem = getReflectionTypeParameters({
|
||||
reflectionType: reflectionType.elementType,
|
||||
project,
|
||||
level: level + 1,
|
||||
level,
|
||||
maxLevel,
|
||||
isReturn: false,
|
||||
})
|
||||
componentItem[parentKey - 1].children?.push(...elementTypeItem)
|
||||
if (
|
||||
reflectionType.elementType.type === "reference" &&
|
||||
elementTypeItem.length === 1
|
||||
) {
|
||||
componentItem[parentKey - 1].children?.push(
|
||||
...(elementTypeItem[0].children || [])
|
||||
)
|
||||
} else {
|
||||
componentItem[parentKey - 1].children?.push(...elementTypeItem)
|
||||
}
|
||||
}
|
||||
} else if (reflectionType.type === "tuple") {
|
||||
let pushTo: Parameter[] = []
|
||||
|
||||
Reference in New Issue
Block a user