Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error TS2339: Property 'nuxtIcon' does not exist on type 'AppConfig' #62

Closed
frasza opened this issue Mar 15, 2023 · 3 comments · Fixed by nuxt/nuxt#20526
Closed

error TS2339: Property 'nuxtIcon' does not exist on type 'AppConfig' #62

frasza opened this issue Mar 15, 2023 · 3 comments · Fixed by nuxt/nuxt#20526

Comments

@frasza
Copy link

frasza commented Mar 15, 2023

Recently upgraded Nuxt Icon in my SPA Nuxt app (using Nuxt 3.3 with SSR set to false and strict typescript) and hit a bug when running npm run generate.

 node_modules/nuxt-icon/dist/runtime/IconCSS.vue:6:28 - error TS2339: Property 'nuxtIcon' does not exist on type 'AppConfig'.

6 const aliases = appConfig?.nuxtIcon?.aliases || {}
                             ~~~~~~~~

node_modules/nuxt-icon/dist/runtime/Icon.vue:11:28 - error TS2339: Property 'nuxtIcon' does not exist on type 'AppConfig'.

11 const aliases = appConfig?.nuxtIcon?.aliases || {}
                              ~~~~~~~~

node_modules/nuxt-icon/dist/runtime/IconCSS.vue:25:39 - error TS2339: Property 'nuxtIcon' does not exist on type 'AppConfig'.


25   if (!props.size && typeof appConfig.nuxtIcon?.size === 'boolean' && !appConfig.nuxtIcon?.size) {
                                                                                    ~~~~~~~~

node_modules/nuxt-icon/dist/runtime/Icon.vue:28:44 - error TS2339: Property 'nuxtIcon' does not exist on type 'AppConfig'.

28 const iconName = computed(() => (appConfig.nuxtIcon?.aliases || {})[props.name] || props.name)
                                              ~~~~~~~~

node_modules/nuxt-icon/dist/runtime/IconCSS.vue:28:40 - error TS2339: Property 'nuxtIcon' does not exist on type 'AppConfig'.

28   const size = props.size || appConfig.nuxtIcon?.size || '1em'
                                          ~~~~~~~~


Found 6 errors in 2 files.

Errors  Files
     4  node_modules/nuxt-icon/dist/runtime/IconCSS.vue:6
     2  node_modules/nuxt-icon/dist/runtime/Icon.vue:11

Created minimal reproduction and posted code on public github repo available here: https://github.com/frasza/nuxt-icon-m-repro-bug

@CosAnca
Copy link

CosAnca commented May 19, 2023

This still seems to be an issue, except this time the errors are on properties of the nuxtIcon instead of the nuxtIcon object.

node_modules/nuxt-icon/dist/runtime/Icon.vue:12:38 - error TS2339: Property 'aliases' does not exist on type '{}'.

12 const aliases = appConfig?.nuxtIcon?.aliases || {}
                                        ~~~~~~~

node_modules/nuxt-icon/dist/runtime/Icon.vue:29:54 - error TS2339: Property 'aliases' does not exist on type '{}'.

29 const iconName = computed(() => (appConfig.nuxtIcon?.aliases || {})[props.name] || props.name)
                                                        ~~~~~~~

node_modules/nuxt-icon/dist/runtime/IconCSS.vue:7:38 - error TS2339: Property 'aliases' does not exist on type '{}'.

7 const aliases = appConfig?.nuxtIcon?.aliases || {}
                                       ~~~~~~~

node_modules/nuxt-icon/dist/runtime/IconCSS.vue:26:49 - error TS2339: Property 'size' does not exist on type '{}'.

26   if (!props.size && typeof appConfig.nuxtIcon?.size === 'boolean' && !appConfig.nuxtIcon?.size) {
                                                   ~~~~

node_modules/nuxt-icon/dist/runtime/IconCSS.vue:26:92 - error TS2339: Property 'size' does not exist on type '{}'.

26   if (!props.size && typeof appConfig.nuxtIcon?.size === 'boolean' && !appConfig.nuxtIcon?.size) {
                                                                                              ~~~~

node_modules/nuxt-icon/dist/runtime/IconCSS.vue:29:50 - error TS2339: Property 'size' does not exist on type '{}'.

29   const size = props.size || appConfig.nuxtIcon?.size || '1em'
                                                    ~~~~


Found 6 errors in 2 files.

Errors  Files
     2  node_modules/nuxt-icon/dist/runtime/Icon.vue:12
     4  node_modules/nuxt-icon/dist/runtime/IconCSS.vue:7

It can be reproduced with the repo linked in the original issue by upgrading the dependencies to latest versions:

"devDependencies": {
    "nuxt": "^3.5.0",
    "nuxt-icon": "^0.4.1"
  },
  "dependencies": {
    "typescript": "^5.0.4",
    "vue-tsc": "^1.6.5"
  }

@some-user123
Copy link

I'm getting the same errors when building. However, they are not reported when using nuxt typecheck 😯

@mandragora-hub
Copy link

mandragora-hub commented Jun 19, 2023

Errors still persist with updated packages.
image

image

In dev, it works as expected. The bugs emerge on a build step. This only occurs if you have typecheck in true
image

Reprodution => https://github.com/mandragora-hub/nuxt-icon-repro-build-bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants