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

Typescript error with SwiperSlideProps interface and @types/react@18 #5799

Closed
5 of 6 tasks
francescocaveglia opened this issue Jun 14, 2022 · 3 comments
Closed
5 of 6 tasks
Labels

Comments

@francescocaveglia
Copy link

francescocaveglia commented Jun 14, 2022

Check that this is really a bug

  • I confirm

Reproduction link

https://github.com/francescocaveglia/swiper-test

Bug description

The SwiperSlideProps interface is not compatible with @types/react@18

(the error is solved with "skipLibCheck": true but I would prefer to avoid it)

Expected Behavior

no typescript error

Actual Behavior

tsc command returns this error:

error TS2430: Interface 'SwiperSlideProps' incorrectly extends interface 'HTMLAttributes<HTMLElement>'.
  Types of property 'children' are incompatible.
    Type 'ReactNode | ((slideData: SlideData) => ReactNode)' is not assignable to type 'ReactNode'.
      Type '(slideData: SlideData) => ReactNode' is not assignable to type 'ReactNode'.

427 interface SwiperSlideProps {

Swiper version

8.2.4

Platform/Target and Browser Versions

Node

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
@edkimmel
Copy link

Seeing this as well.

  Type 'ComponentClass<any, any>' is not assignable to type 'ReactNode | ((slideData: SlideData) => ReactNode)'.

@sangmin802
Copy link

Is it solved??

@dschueller-cs
Copy link

I ended up having to downgrade to React 17 to resolve this.

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

4 participants