Skip to content

Commit a6e6104

Browse files
authored
docs: unwrap nested named union and literal types (#1965)
1 parent 8516bfb commit a6e6104

File tree

3 files changed

+82
-27
lines changed

3 files changed

+82
-27
lines changed

scripts/apidoc/signature.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,17 @@ function typeToText(type_?: Type, short = false): string {
304304

305305
case 'reference':
306306
if (!type.typeArguments || !type.typeArguments.length) {
307-
return type.name;
307+
const reflection = type.reflection as DeclarationReflection | undefined;
308+
const reflectionType = reflection?.type;
309+
if (
310+
(reflectionType?.type === 'literal' ||
311+
reflectionType?.type === 'union') &&
312+
!type.name.match(/Char$/)
313+
) {
314+
return typeToText(reflectionType, short);
315+
} else {
316+
return type.name;
317+
}
308318
} else if (type.name === 'LiteralUnion') {
309319
return [
310320
typeToText(type.typeArguments[0], short),

0 commit comments

Comments
 (0)