Skip to content

TS2786: 'Moment' cannot be used as a JSX component. Everything worked before the upgrading to 1.1.2 #148

New issue

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

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

Already on GitHub? # to your account

Closed
Anvarmirzo opened this issue Apr 8, 2022 · 6 comments

Comments

@Anvarmirzo
Copy link

TS2786: 'Moment' cannot be used as a JSX component.

Its instance type 'Moment' is not a valid JSX element.

The types returned by 'render()' are incompatible between these types.

Type 'React.ReactNode' is not assignable to type 'import("C:
/Users/Dior2/Anvar/custom/smarts/smarts/client/node_modules/@types/react-router/node_modules/@types/react/index")
.ReactNode'.

Type '{}' is not assignable to type 'ReactNode'.

Type '{}' is missing the following properties from type 'ReactPortal': key, children, type, props

@tylergarside
Copy link

Receiving the same error, was still on 1.1.1 though

@ozluy
Copy link

ozluy commented Apr 9, 2022

same here :( version 1.1.1

@heyalbertdev
Copy link

Same here

@ozluy
Copy link

ozluy commented Apr 10, 2022

"resolutions": {
"@types/react": "17.0.43",
}
  • add above snippet to your package.json under resolutions
  • remove your node_modules folder
  • run yarn install

Solves it, discussion can be found here => facebook/react#24304 (comment)

@heyalbertdev
Copy link

@ozluy thank you

@Anvarmirzo
Copy link
Author

#148 (comment) thanks!

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

No branches or pull requests

4 participants