swiper
swiper copied to clipboard
Typescript error with `SwiperSlideProps` interface and `@types/react@18`
Check that this is really a bug
- [X] 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
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
- [X] 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
Seeing this as well.
Type 'ComponentClass<any, any>' is not assignable to type 'ReactNode | ((slideData: SlideData) => ReactNode)'.
Is it solved??
I ended up having to downgrade to React 17 to resolve this.