HiDeoo / intro.js-react

Intro.js react wrapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

joaoguilhermee opened this issue · comments

Describe the bug

I am having problems using the intro.js with typescript

`'Steps' cannot be used as a JSX component.
Its instance type 'Steps' 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("/Users/_j/Github/project/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode'.
Type '{}' is not assignable to type 'ReactNode'.

`

To Reproduce

  1. Just add the or on the project

Expected behavior

This should work as expected with TS

How often does this bug happen?

Every time

System Info

No response

Additional Context

No response

This is a fairly common issue when having multiple versions of @types/react used as dependency by third-party libraries that are incompatible.

The incompatibility in your case is due to React 17 types for ReactNode including {} which was removed in the React 18 types.

As specified in the linked comment, you can fix this issue by pinning the version of @types/react in your project, depending on your package manager: