AICCOF / chatmoss-ui

ChatMoss 交互层开源代码
MIT License
271 stars 65 forks source link

启动不起来,代码优化 ==》期待奖励哈哈哈哈 #77

Closed samqin123 closed 1 year ago

samqin123 commented 1 year ago

vite v4.2.1 building for mac... transforming (2885) node_modules/highlight.js/lib/languages/json.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


  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

======= The error message indicates that the icon prop is defined as type string | IconifyIcon, which means it can accept a string or an object of type IconifyIcon. However, the actual value being passed to the icon prop is undefined, which is not a valid value for either type. As a result, TypeScript is raising an error.

To fix this issue, you should check where the icon prop is being passed to the SvgIcon component and ensure that it is assigned a valid value. One way to fix this is to provide a default value for the icon prop, like so:

props: { icon: { type: [String, Object] as PropType<string | IconifyIcon>, default: 'default-icon' // replace 'default-icon' with a valid default value } } Alternatively, you can check the code that is rendering the SvgIcon component and ensure that the icon prop is being passed a valid value. For example:

In the above code snippet, the icon prop is being passed the string value 'my-icon', which is a valid value for the string type. You should replace 'my-icon' with a valid icon name or object as required by your application.

这个错误信息提示你的 Vue.js 组件 SvgIcon 存在类型不匹配的问题,具体出现在 node_modules/highlight.js/lib/languages/gcode.js 文件的第 20 行。

错误信息显示 icon 属性的类型为 string | IconifyIcon,即该属性可以接受字符串或 IconifyIcon 对象类型的值。然而,实际传递给 icon 属性的值是 undefined,这既不是字符串类型,也不是 IconifyIcon 对象类型,因此 TypeScript 抛出了错误。

为了解决这个问题,你需要检查 icon 属性在哪里传递给 SvgIcon 组件,并确保为它赋予一个有效的值。一种解决方法是为 icon 属性提供一个默认值,示例如下:

props: { icon: { type: [String, Object] as PropType<string | IconifyIcon>, default: 'default-icon' // 将 'default-icon' 替换为一个有效的默认值 } } 另外,你可以检查渲染 SvgIcon 组件的代码,确保 icon 属性被传递了一个有效的值。例如:

在上面的代码片段中,icon 属性被传递了字符串值 'my-icon',这是 string 类型的有效值。你需要根据应用程序的要求,将 'my-icon' 替换为一个有效的图标名称或对象。

zhukunpenglinyutong commented 1 year ago

v2.1.7 和 v2.1.8 两个版本有这个问题,正在修复,可以在QQ群中艾特我,给您兑现100万字符包兑换码

samqin123 commented 1 year ago

qq群号是? 我看了好像issue里面没有,readme也没有


From: 朱昆鹏 @.> Sent: Saturday, April 15, 2023 3:40 AM To: AICCOF/chatmoss-ui @.> Cc: samqin123 @.>; Author @.> Subject: Re: [AICCOF/chatmoss-ui] 启动不起来,代码优化 ==》期待奖励哈哈哈哈 (Issue #77)

v2.1.7 和 v2.1.8 两个版本有这个问题,正在修复,可以在QQ群中艾特我,给您兑现100万字符包兑换码

― Reply to this email directly, view it on GitHubhttps://github.com/AICCOF/chatmoss-ui/issues/77#issuecomment-1509487934, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYY7MIC7POBKXYWZO7L27S3XBIKD3ANCNFSM6AAAAAAW6NQMQM. You are receiving this because you authored the thread.Message ID: @.***>

zhukunpenglinyutong commented 1 year ago

qq群:458538531

samqin123 commented 1 year ago

我入了QQ群,然后找谁领呢?


From: 朱昆鹏 @.> Sent: Sunday, April 16, 2023 3:39 PM To: AICCOF/chatmoss-ui @.> Cc: samqin123 @.>; Author @.> Subject: Re: [AICCOF/chatmoss-ui] 启动不起来,代码优化 ==》期待奖励哈哈哈哈 (Issue #77)

qq群:458538531

― Reply to this email directly, view it on GitHubhttps://github.com/AICCOF/chatmoss-ui/issues/77#issuecomment-1510415854, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYY7MIAOEZVMGVEJHZ3HNQDXBQHCLANCNFSM6AAAAAAW6NQMQM. You are receiving this because you authored the thread.Message ID: @.***>