@@ -162,12 +162,16 @@ export function getTemplates(options: ModuleOptions, uiConfig: Record<string, an
162162 // FIXME: `typeof colors[number]` should include all colors from the theme
163163 templates . push ( {
164164 filename : 'types/ui.d.ts' ,
165- getContents : ( ) => `import * as ui from '#build/ui'
165+ getContents : ( ) => {
166+ const iconKeys = Object . keys ( uiConfig ?. icons || { } )
167+ const iconUnion = iconKeys . length ? iconKeys . map ( i => JSON . stringify ( i ) ) . join ( ' | ' ) : 'string'
168+
169+ return `import * as ui from '#build/ui'
166170import type { TVConfig } from '@nuxt/ui'
167171import type { defaultConfig } from 'tailwind-variants'
168172import colors from 'tailwindcss/colors'
169173
170- const icons = ${ JSON . stringify ( uiConfig . icons ) } ;
174+ type IconsConfig = Record< ${ iconUnion } | (string & {}), string>
171175
172176type NeutralColor = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone'
173177type Color = Exclude<keyof typeof colors, 'inherit' | 'current' | 'transparent' | 'black' | 'white' | NeutralColor> | (string & {})
@@ -177,7 +181,7 @@ type AppConfigUI = {
177181 ${ options . theme ?. colors ?. map ( color => `'${ color } '?: Color` ) . join ( '\n\t\t' ) }
178182 neutral?: NeutralColor | (string & {})
179183 }
180- icons?: Partial<typeof icons >
184+ icons?: Partial<IconsConfig >
181185 tv?: typeof defaultConfig
182186} & TVConfig<typeof ui>
183187
@@ -193,6 +197,7 @@ declare module '@nuxt/schema' {
193197
194198export {}
195199`
200+ }
196201 } )
197202
198203 templates . push ( {
0 commit comments