From 885f027e36527dd4bd984f17e8306fb818fc5bb1 Mon Sep 17 00:00:00 2001 From: Mohamed Shams El-Deen Date: Fri, 3 Jul 2026 21:11:50 +0300 Subject: [PATCH] fix(types): correct intersection and reflection AST resolution --- plugins/theme/partials/types.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/theme/partials/types.mjs b/plugins/theme/partials/types.mjs index 5ef6c2eb..d4f69be7 100644 --- a/plugins/theme/partials/types.mjs +++ b/plugins/theme/partials/types.mjs @@ -1,4 +1,4 @@ -const union = (arr, sep = '|') => +const joinTypes = (arr, sep = ' | ') => arr?.length ? arr.map(resolve).join(sep) : 'unknown'; const resolve = type => { @@ -22,11 +22,13 @@ const resolve = type => { return resolve(type.elementType) + '[]'; case 'tuple': - return `Tuple< ${union(type.elements, ', ')} >`; + return `Tuple< ${joinTypes(type.elements, ', ')} >`; case 'union': + return joinTypes(type.types); + case 'intersection': - return union(type.types); + return joinTypes(type.types, ' & '); case 'optional': case 'indexedAccess': @@ -45,7 +47,7 @@ const resolve = type => { return resolve(type.element); case 'reflection': - return 'object'; + return type.declaration?.signatures?.length ? 'Function' : 'object'; case 'inferred': case 'unknown':