Type error when `noUncheckedIndexedAccess` is enabled
Tsuyoshi84 opened this issue · comments
Tsuyoshi Yamaguchi commented
Environment
Nuxt: 3.9.1
icon: 0.6.8
Bug Description
A type error occurs when the TypeScript compiler option noUncheckedIndexedAccess is enabled.
When the option is enabled, TypeScript considers that the type of the following computed, iconName
, is string | undefined
And because of that, the following code becomes invalid because nuxtApp.vueApp.component()
takes a string
value, not string | undefined
:
Reproduction
You can reproduce the error by running "npm run typecheck" in the following environment:
https://stackblitz.com/edit/nuxt-icon-playground-q1bjwm?file=nuxt.config.ts