chatgpt-web
chatgpt-web copied to clipboard
在linux和widdows下编译都报错,前几天倒是OK的
transforming (2058) node_modules\naive-ui\es\dropdown\src\DropdownOption.jssrc/components/common/SvgIcon/index.vue:20:9 - error TS2322: Type 'string | undefined' is not assignable to type 'string | IconifyIcon'. Type 'undefined' is not assignable to type 'string | IconifyIcon'.
20 <Icon :icon="icon" v-bind="bindAttrs" /> ~~~~~
node_modules/@iconify/vue/dist/iconify.d.ts:259:5 259 icon: IconifyIcon | string; ~~~~ The expected type comes from property 'icon' which is declared here on type 'ComponentProps<DefineComponent<IconProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<...>, {}>>'
Found 1 error in src/components/common/SvgIcon/index.vue:20
transforming (2115) node_modules\naive-ui\es_utils\dom\is-document.jsERROR: "type-check" exited with 2.
我也是这个问题
这是由不兼容的类型分配引起的 TypeScript 编译错误。错误消息表明类型为“string |”的变量undefined'被分配给'string |类型的变量IconifyIcon',这是不允许的。该问题出现在文件“DropdownOption.jssrc/components/common/SvgIcon/index.vue”的第 20 行。此外,文件“is-document.js”中还有另一个错误似乎与第一个错误无关.
改为这个就行了,刚问的chatgpt,哈哈哈
<Icon :icon="icon as string" v-bind="bindAttrs" />
改为这个就行了,刚问的chatgpt,哈哈哈
<Icon :icon="icon as string" v-bind="bindAttrs" />
我也是遇到这个问题了,方案亲测可用
找到项目目录:执行 vim -r src/components/common/SvgIcon/index.vue 将 :icon="icon" 替换为 :icon="icon as string"
This issue is stale because it has been open for 10 days with no activity.
This issue was closed because it has been inactive for 2 days since being marked as stale.