gitFoxCode / nuxt-icons

Module for Nuxt allowing pleasant use of svg icons
187 stars 23 forks source link

vue-tsc error at line 27 of nuxt-icon.vue, while activated noUncheckedIndexedAccess in tsconfig #55

Open tsukuha opened 3 months ago

tsukuha commented 3 months ago

Describe the bug I found a bug about type error. vue-tsc error at line 27 of nuxt-icon.vue, while activated noUncheckedIndexedAccess in tsconfig.

To Reproduce

It occurs vue-tsc error on building nuxt-icons.

Expected behavior

// nuxt-icons/dist/runtime 27 line
const rawIcon = await iconsImport[`/assets/icons/${props.name}.svg`]()

Maybe, It needs to fix.

const iconsImportFunc = iconsImport[`/assets/icons/${props.name}.svg`]
if (iconsImportFunc === undefined) {
  return
}
const rawIcon = await iconsImportFunc()

Screenshots

スクリーンショット 2024-04-08 16 46 38

Desktop (please complete the following information):