Closed danielroe closed 1 year ago
Thank you @danielroe
It's weird since I declared the nuxtIcon
types on https://github.com/nuxt-modules/icon/blob/main/src/module.ts#L8
Regarding the types for state, I am more than happy to get your help on typings, definitely not a TS expert on my side 😅
Created the https://github.com/nuxt-modules/icon/tree/fix/ts-check branch and setup the playground, but cannot get the nuxtIcon
error 🤔
There's an app.config.ts
on your branch that doesn't exists on the issue's stackblitz. Maybe it's missing some default values?
I'm seeing the same problem when enabling typecheck in nuxt.config.ts and running `nuxt dev:
ERROR(vue-tsc) Property 'nuxtIcon' does not exist on type 'AppConfig'.
FILE .../node_modules/.pnpm/nuxt-icon@0.3.3/node_modules/nuxt-icon/dist/runtime/IconCSS.vue:6:28
4 | 12:32:15
5 | const appConfig = useAppConfig()
> 6 | const aliases = appConfig?.nuxtIcon?.aliases || {}
| ^^^^^^^^
7 |
8 | type AliasesKeys = keyof typeof aliases
9 |
ERROR(vue-tsc) Property 'nuxtIcon' does not exist on type 'AppConfig'.
FILE .../node_modules/.pnpm/nuxt-icon@0.3.3/node_modules/nuxt-icon/dist/runtime/Icon.vue:11:28
9 | const nuxtApp = useNuxtApp()
10 | const appConfig = useAppConfig()
> 11 | const aliases = appConfig?.nuxtIcon?.aliases || {}
| ^^^^^^^^
12 |
13 | type AliasesKeys = keyof typeof aliases
14 |
ERROR(vue-tsc) Property 'nuxtIcon' does not exist on type 'AppConfig'.
FILE .../node_modules/.pnpm/nuxt-icon@0.3.3/node_modules/nuxt-icon/dist/runtime/IconCSS.vue:25:39
23 | const sSize = computed(() => {
24 | // Disable size if appConfig.nuxtIcon.size === false
> 25 | if (!props.size && typeof appConfig.nuxtIcon?.size === 'boolean' && !appConfig.nuxtIcon?.size) {
| ^^^^^^^^
26 | return undefined
27 | }
28 | const size = props.size || appConfig.nuxtIcon?.size || '1em'
...
Do you need a reproduction?
Reproduction: https://stackblitz.com/edit/github-xn5tih