From 3b73f9e9f77e77bfcd220feb8c1b4d68fd9520ce Mon Sep 17 00:00:00 2001 From: Hannes Rasmussen Date: Fri, 18 Oct 2024 12:53:07 +0200 Subject: [PATCH 1/2] fix: default to empty array if no signatures are found --- packages/component-meta/lib/base.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/component-meta/lib/base.ts b/packages/component-meta/lib/base.ts index a0d9fbd5b8..297b13f898 100644 --- a/packages/component-meta/lib/base.ts +++ b/packages/component-meta/lib/base.ts @@ -540,7 +540,7 @@ function createSchemaResolvers( function resolveSlotProperties(prop: ts.Symbol): SlotMeta { const propType = typeChecker.getNonNullableType(typeChecker.getTypeOfSymbolAtLocation(prop, symbolNode)); const signatures = propType.getCallSignatures(); - const paramType = signatures[0].parameters[0]; + const paramType = signatures.length > 0 ? signatures[0].parameters[0] : []; const subtype = paramType ? typeChecker.getTypeOfSymbolAtLocation(paramType, symbolNode) : typeChecker.getAnyType(); let schema: PropertyMetaSchema; let declarations: Declaration[]; From e32138121a56b6ab81529da40fea0dce58060c5f Mon Sep 17 00:00:00 2001 From: Hannes Rasmussen <111380153+Hannesrasmussen@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:38:57 +0200 Subject: [PATCH 2/2] Update packages/component-meta/lib/base.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 山吹色御守 <85992002+KazariEX@users.noreply.github.com> --- packages/component-meta/lib/base.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/component-meta/lib/base.ts b/packages/component-meta/lib/base.ts index 297b13f898..901dda662a 100644 --- a/packages/component-meta/lib/base.ts +++ b/packages/component-meta/lib/base.ts @@ -540,7 +540,7 @@ function createSchemaResolvers( function resolveSlotProperties(prop: ts.Symbol): SlotMeta { const propType = typeChecker.getNonNullableType(typeChecker.getTypeOfSymbolAtLocation(prop, symbolNode)); const signatures = propType.getCallSignatures(); - const paramType = signatures.length > 0 ? signatures[0].parameters[0] : []; + const paramType = signatures[0]?.parameters[0]; const subtype = paramType ? typeChecker.getTypeOfSymbolAtLocation(paramType, symbolNode) : typeChecker.getAnyType(); let schema: PropertyMetaSchema; let declarations: Declaration[];