Open tsukuha opened 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.
nuxt.config.ts
export default defineNuxtConfig({ ssr: false, typescript: { typeCheck: true, }, app: { head: { charset: 'utf-8', title: '', }, }, modules: ['nuxt-icons'], vue: { compilerOptions: { whitespace: 'preserve', }, }, telemetry: false, devtools: { enabled: true }, })
tsconfig.json
{ "extends": "./.nuxt/tsconfig.json", "compilerOptions": { "noUncheckedIndexedAccess": true } }
package.json
{ "name": "test", "version": "1.0.0", "description": "", "author": "", "scripts": { "build": "nuxt build", "dev": "rm -rf /tmp/nitro && HOST=0.0.0.0 PORT=8080 nuxt dev", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare", }, "dependencies": { "nuxt": "^3.8.2", "nuxt-icons": "^3.2.1", "sass": "^1.69.5", "vue": "^3.3.10", }, "devDependencies": { "@nuxt/devtools": "latest", "typescript": "^5.4.3", "vue-tsc": "^1.8.27" }, "optionalDependencies": { "@rollup/rollup-linux-arm64-gnu": "^4.9.1", "@rollup/rollup-linux-x64-gnu": "^4.9.1" } }
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
Desktop (please complete the following information):
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.
nuxt.config.ts
tsconfig.json
package.json
Expected behavior
Maybe, It needs to fix.
Screenshots
Desktop (please complete the following information):