Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“DatePicker.RangePicker”不能用作 JSX 组件。 其实例类型 "Component<RangePickerProps, any, any>" 不是有效的 JSX 元素。 #781

Closed
1 task
luyuanky opened this issue Apr 18, 2022 · 9 comments
Assignees
Labels

Comments

@luyuanky
Copy link

luyuanky commented Apr 18, 2022

基本信息

  • 依赖包名 及 版本: @arco-design/web-react@2.32.0
  • 浏览器版本: chrome100.0.4896.75
  • 复现地址: 构建错误,无法提供复现链接

预期结果

不报错

复现步骤

使用arco-design pro 创建项目
无任何代码修改,正常启动
示例代码 <DatePicker.RangePicker /> 出现ts报错

image

@PengJiyuan
Copy link
Member

react 是什么版本

@luyuanky
Copy link
Author

反应是什么版本

v16.9.0

@simsir-lin
Copy link

我也遇到这种情况,请问解决了吗?

@jiahao-c
Copy link
Contributor

jiahao-c commented May 3, 2022

@luyuanky @simsir-lin 方便提供下生成出来的完整项目代码吗?可以上传到一个github repo里,然后贴个链接~

@hzgotb
Copy link

hzgotb commented May 10, 2022

@luyuanky @simsir-lin 方便提供下生成出来的完整项目代码吗?可以上传到一个github repo里,然后贴个链接~

react的类型错误。facebook/react#24304 (comment)

@yinkaihui yinkaihui self-assigned this Jun 20, 2022
@yuhan0709
Copy link
Member

可以自查一下是不是有多版本的@types/react
react-navigation/react-navigation#10507 (comment)

@luyuanky
Copy link
Author

可以自查一下是不是继承的@types/react react-navigation/react-navigation#10507(评论)

果然是这个问题 发现内部依赖有多个@types/react的版本
image

@hesetiema
Copy link

临时的办法:const RangePicker = DatePicker.RangePicker as any;

@yinkaihui
Copy link
Contributor

可以自查一下是不是有多版本的@types/react react-navigation/react-navigation#10507 (comment)

一般是这个原因导致的,可参考解决方案

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants