aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-03-29 09:39:27 +0200
committerGitHub <[email protected]>2023-03-29 09:39:27 +0200
commita6e61043be6ce6608995fc215fbe60a284bd8c1d (patch)
tree231c01127f7e888e88d44c2eef64162a6e69615b /scripts
parent8516bfb109741231a49ec8572176e5a12b4c1a37 (diff)
downloadfaker-a6e61043be6ce6608995fc215fbe60a284bd8c1d.tar.xz
faker-a6e61043be6ce6608995fc215fbe60a284bd8c1d.zip
docs: unwrap nested named union and literal types (#1965)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/apidoc/signature.ts12
1 files changed, 11 insertions, 1 deletions
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),