Skip to content

Commit

Permalink
docs: unwrap nested named union and literal types (#1965)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Mar 29, 2023
1 parent 8516bfb commit a6e6104
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 27 deletions.
12 changes: 11 additions & 1 deletion scripts/apidoc/signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,17 @@ function typeToText(type_?: Type, short = false): string {

case 'reference':
if (!type.typeArguments || !type.typeArguments.length) {
return type.name;
const reflection = type.reflection as DeclarationReflection | undefined;
const reflectionType = reflection?.type;
if (
(reflectionType?.type === 'literal' ||
reflectionType?.type === 'union') &&
!type.name.match(/Char$/)
) {
return typeToText(reflectionType, short);
} else {
return type.name;
}
} else if (type.name === 'LiteralUnion') {
return [
typeToText(type.typeArguments[0], short),
Expand Down
Loading

0 comments on commit a6e6104

Please sign in to comment.