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 throws error "cannot be used as a JSX component" #34952
Comments
@xsephtion same issue I am facing, did you get a solution for this ? |
I did, what I had to do is to is
I think this is just a quick and temporary fix. |
@xsephtion can you provide how you found a solution to do force-resolutions for this issue? |
@xsephtion Thanks for sharing. |
Would it make sense to change the dependencies on types to be optional peer deps? facebook/react#24304 (comment) |
I managed to fix the issue by forcing installation of types version 17, as told in #34952 (comment)
It would be useful to add this solution in FAQ |
I had the same problem, my solution was to update At the root of the project run If it doesn't work, delete node_modules, and install the packs again. |
I use react 16 ,can i add latest @types/react ? @ThielNS |
原因是ts与@types/react版本不适配。 解决将@types/react的版本与ts的版本对应上即可。 查询版本对应关系查看npm,找到二者的版本对应关系如下:https://www.npmjs.com/package/@types/react 查询本地ts版本可以查询到本地版本为4.7.3。 C:\Users\Administrator\Documents\GitHub\react-bpmn>npm view typescript version
4.7.3 查询本地@types/react版本在package.json文件中查看,@types/react 与 @types/react-dom 的版本。 查询@types/react与ts的具体适配版本可以看到 ts4.7适配18.0.12。 npm info @types/react
dist-tags:
latest: 18.0.12 ts2.2: 15.0.30 ts2.5: 16.0.36 ts2.8: 16.9.34 ts3.1: 16.9.49 ts3.4: 17.0.2 ts3.7: 17.0.35 ts4.0: 18.0.12 ts4.3: 18.0.12 ts4.6: 18.0.12
ts2.0: 15.0.1 ts2.3: 16.0.36 ts2.6: 16.4.7 ts2.9: 16.9.35 ts3.2: 16.9.56 ts3.5: 17.0.8 ts3.8: 17.0.39 ts4.1: 18.0.12 ts4.4: 18.0.12 ts4.7: 18.0.12
ts2.1: 15.0.20 ts2.4: 16.0.36 ts2.7: 16.4.7 ts3.0: 16.9.46 ts3.3: 17.0.0 ts3.6: 17.0.19 ts3.9: 18.0.12 ts4.2: 18.0.12 ts4.5: 18.0.12 ts4.8: 18.0.12 查询@types/react-dom与ts的具体适配版本可以看到 ts4.7适配18.0.5。 npm info @types/react-dom
dist-tags:
latest: 18.0.5 ts2.2: 15.5.0 ts2.5: 16.0.3 ts2.8: 16.9.7 ts3.1: 16.9.8 ts3.4: 17.0.1 ts3.7: 17.0.11 ts4.0: 18.0.5 ts4.3: 18.0.5 ts4.6: 18.0.5
ts2.0: 0.14.20 ts2.3: 16.0.3 ts2.6: 16.0.6 ts2.9: 16.9.8 ts3.2: 16.9.9 ts3.5: 17.0.5 ts3.8: 17.0.11 ts4.1: 18.0.5 ts4.4: 18.0.5 ts4.7: 18.0.5
ts2.1: 15.5.0 ts2.4: 16.0.3 ts2.7: 16.0.6 ts3.0: 16.9.8 ts3.3: 17.0.0 ts3.6: 17.0.9 ts3.9: 18.0.5 ts4.2: 18.0.5 ts4.5: 18.0.5 ts4.8: 18.0.5 执行修改修改package.json中@types/react与@types/react-dom的版本并执行npm install即可。 |
这样不行,我试过本地4.7我需要适配 18版本的types,但是18版本的会报错,modal,因为现在18的reactchildrenprops也需要定义 |
I had same problem, I solved it by changing
TO
|
Is it possible to make this work with a DatePicker instead of a RangePicker? |
|
I ran |
使用这个解决方案,会报错: |
With @types/react@18.2.45 this still seems to be an issue, do you happen to know if there's an issue somewhere to track whether this will be resolved in a release? |
Reproduction link
https://gist.github.com/xsephtion/34327c7484dc17a7cdbcf014462ce198
Steps to reproduce
Run build on GitHub Actions (Self-hosted, or GitHub Runners)
Build will throw:
Type error: 'DatePicker' cannot be used as a JSX component.
Its instance type 'Component<PickerProps & { status?: "" | "error" | "warning" | undefined; }, unknown, any> & CommonPickerMethods' is not a valid JSX element.
What is expected?
Successful Build
What is actually happening?
Build is throwing error
All of a sudden our pipelines were failing.
The text was updated successfully, but these errors were encountered: