From 91515daacec69b4072fc09dcbff5e6131fd1b1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Petri=C4=8D=C3=A1k?= Date: Tue, 16 Sep 2025 00:23:51 +0200 Subject: [PATCH 1/2] fix(types): fix ambient type declaration error by replacing const with type --- src/templates.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templates.ts b/src/templates.ts index c5e1036f96..0cab77082d 100644 --- a/src/templates.ts +++ b/src/templates.ts @@ -206,7 +206,7 @@ import type { TVConfig } from '@nuxt/ui' import type { defaultConfig } from 'tailwind-variants' import colors from 'tailwindcss/colors' -const icons = ${JSON.stringify(uiConfig.icons)}; +type IconsConfig = ${JSON.stringify(uiConfig.icons)}; type NeutralColor = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone' type Color = Exclude | (string & {}) @@ -216,7 +216,7 @@ type AppConfigUI = { ${options.theme?.colors?.map(color => `'${color}'?: Color`).join('\n\t\t')} neutral?: NeutralColor | (string & {}) } - icons?: Partial + icons?: Partial tv?: typeof defaultConfig } & TVConfig From 58fa7b676ebdd593d82f4d1ace5d1d1fddcc7a21 Mon Sep 17 00:00:00 2001 From: Sandro Circi Date: Tue, 16 Sep 2025 01:10:44 +0200 Subject: [PATCH 2/2] fix(module): improve type template for AppConfig icons --- src/templates.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/templates.ts b/src/templates.ts index 0cab77082d..31898d56a7 100644 --- a/src/templates.ts +++ b/src/templates.ts @@ -201,12 +201,16 @@ export function getTemplates(options: ModuleOptions, uiConfig: Record `import * as ui from '#build/ui' + getContents: () => { + const iconKeys = Object.keys(uiConfig?.icons || {}) + const iconUnion = iconKeys.length ? iconKeys.map(i => JSON.stringify(i)).join(' | ') : 'string' + + return `import * as ui from '#build/ui' import type { TVConfig } from '@nuxt/ui' import type { defaultConfig } from 'tailwind-variants' import colors from 'tailwindcss/colors' -type IconsConfig = ${JSON.stringify(uiConfig.icons)}; +type IconsConfig = Record<${iconUnion} | (string & {}), string> type NeutralColor = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone' type Color = Exclude | (string & {}) @@ -232,6 +236,7 @@ declare module '@nuxt/schema' { export {} ` + } }) templates.push({