From 9753f2ba723847c4fa1cf2b3868a777eafc5170c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r=20Sofuo=C4=9Flu?= Date: Tue, 28 Mar 2023 14:51:23 +0300 Subject: [PATCH] Types function changes --- api-generator/build-apidoc.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/api-generator/build-apidoc.js b/api-generator/build-apidoc.js index 0f5cfee7b..2fc2719b5 100644 --- a/api-generator/build-apidoc.js +++ b/api-generator/build-apidoc.js @@ -24,7 +24,7 @@ app.options.addReader(new TypeDoc.TypeDocReader()); app.bootstrap({ // typedoc options here name: 'PrimeVue', - entryPoints: [`components/lib`], + entryPoints: [`components/lib/`], entryPointStrategy: 'expand', hideGenerator: true, excludeExternals: true, @@ -52,7 +52,7 @@ if (project) { doc[name] = { description }; - + const module_component_group = module.groups.find((g) => g.title === 'Component'); let methods = { description: staticMessages['methods'], @@ -441,6 +441,24 @@ if (project) { }); let values = event.type.toString(); + + if (values.includes('Function') && event.type.types) { + values = ''; + + for (const [i, type] of event.type.types.entries()) { + if (type.declaration && type.declaration.signatures) { + const signature = type.declaration.signatures[0]; + const parameters = signature.parameters.reduce((acc, { name, type }, index) => (index === 0 ? `${name}: ${type.name}` : `${acc}, ${name}: ${type.name}`), ''); + + values += i === 0 ? `(${parameters}) => ${signature.type?.name}` : ` | (${parameters}) => ${signature.type?.name}`; + } else { + const typeName = type.name || type.value; + + values += i === 0 ? `${typeName}` : ` | ${typeName}`; + } + } + } + const declaration = event.type.declaration; if (declaration) {