swiper icon indicating copy to clipboard operation
swiper copied to clipboard

Property 'slidesGrid' does not exist on type 'Swiper'

Open jimfoambox opened this issue 7 months ago • 0 comments

Check that this is really a bug

  • [X] I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-type-slidesgrid-wwysty?file=%2Fsrc%2FApp.tsx%3A5%2C24

Bug description

Attempting to utilize the slidesGrid property correctly in TS without errors, which is definitely console logging the correct data in my use case and working as it should. However, in the process of converting this project from JS to TS, I have been hit with this TS linter error: Property 'slidesGrid' does not exist on type 'Swiper'.

The codesandbox example I have created goes directly to the types source file in order to better illustrate the problem, but in my project I am simply importing the type from the library:

import type { Swiper as SwiperType } from 'swiper';

I am assuming adding the property to swiper-class.d.ts (or perhaps there is a more appropriate place for this particular prop) would resolve the issue, and if that is the case, I am happy to create a PR with that addition.

Thanks.

Expected Behavior

slidesGrid shows up as property of the Swiper interface

Actual Behavior

TS linter error: Property 'slidesGrid' does not exist on type 'Swiper'.

Swiper version

11.1.4

Platform/Target and Browser Versions

All

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?

  • [X] I'm willing to open a PR

jimfoambox avatar Jul 08 '24 16:07 jimfoambox