3lang3 / react-vant

React mobile UI Components base on Vant
https://react-vant.3lang.dev
MIT License
1.32k stars 189 forks source link

🐛 [Bug]: Icon 结合 ts 编译Bug #723

Open szl-shalom opened 4 months ago

szl-shalom commented 4 months ago

Which React Vant packages are impacted?

What version of React Vant are you using?

3.35

Reproduce live demo(codesandebox or stackblitz)?

No response

Descripition

使用的React-vant 版本是 3.3.5 node 版本 18.20 React 版本 18.3.1

szl-shalom commented 4 months ago

ts 提示

szl-shalom commented 4 months ago

类型“{}”缺少类型“Pick<Omit<IconBaseProps, "name">, "string" | "filter" | "fill" | "values" | "id" | "children" | "className" | "onClick" | "spin" | "rotate" | "style" | "color" | ... 457 more ... | "onPointerLeaveCapture">”中的以下属性: onPointerEnterCapture, onPointerLeaveCapture icon ts 警告

szl-shalom commented 4 months ago

解决方案 :
<ArrowLeft onPointerEnterCapture={() => {}} onPointerLeaveCapture={() => {}} />

szl-shalom commented 4 months ago

官网也修复下类型吧

3lang3 commented 4 months ago

@szl-shalom 方便提pr吗

wennjie commented 4 months ago

https://github.com/3lang3/react-vant/pull/721 已处理 但是打包失败

szl-shalom commented 4 months ago

原来的问题是, 在编码的时候, 咱们ts检测的类型有问题, 组件是icon图表 WechatIMG796 后来我在下载了其他项目, 官方大大应该解决了这个问题 WechatIMG795

szl-shalom commented 4 months ago

我在用这个icon 图标的时候, 会出现如下ts类型检测问题

image

当时我的解决方案就是加上了这两个属性, 让ts暂时检测通过

image
szl-shalom commented 4 months ago

@szl-shalom 方便提pr吗

看下下面我回复呢

beilo commented 3 months ago

使用react和 react-dom 是 18.2 能暂时解决这个问题。 并且如果使用 18.3 版本,控制台会有个 defaultProps 的警告。