From a6e61043be6ce6608995fc215fbe60a284bd8c1d Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 29 Mar 2023 09:39:27 +0200 Subject: docs: unwrap nested named union and literal types (#1965) --- scripts/apidoc/signature.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 109cd55d..c41b758c 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -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), -- cgit v1.2.3