We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
snapIndex
Swiper
https://codesandbox.io/s/swiper-pagination-react-forked-bdgf3d?file=/src/App.jsx
The type of snapIndex does not exist in type Swiper. In fact, it is any, despite the fact that it is a number.
any
Developers need to add the following code to global.d.ts to use snapIndex.
global.d.ts
declare module 'swiper' { interface Swiper { snapIndex: number; } }
* It is not present by default. When updateIndex is called, the snapIndex property appears by Object.assign. https://github.com/nolimits4web/swiper/blob/master/src/core/update/updateActiveIndex.js#L55-L60 * It does not exist in document. But snapIndexChange exists. https://swiperjs.com/swiper-api#event-snapIndexChange
updateIndex
Object.assign
snapIndexChange
TypeScript knows type of snapIndex as number.
TypeScript does not know type of snapIndex as number. It knows as any.
8.1.3
macOS 12.3.1 Visual Studio Code latest
The text was updated successfully, but these errors were encountered:
ee3d2dc
No branches or pull requests
Check that this is really a bug
Reproduction link
https://codesandbox.io/s/swiper-pagination-react-forked-bdgf3d?file=/src/App.jsx
Bug description
The type of
snapIndex
does not exist in typeSwiper
.In fact, it is
any
, despite the fact that it is a number.Developers need to add the following code to
global.d.ts
to usesnapIndex
.* It is not present by default. When
updateIndex
is called, thesnapIndex
property appears byObject.assign
.https://github.com/nolimits4web/swiper/blob/master/src/core/update/updateActiveIndex.js#L55-L60
* It does not exist in document. But
snapIndexChange
exists.https://swiperjs.com/swiper-api#event-snapIndexChange
Expected Behavior
TypeScript knows type of
snapIndex
as number.Actual Behavior
TypeScript does not know type of
snapIndex
as number. It knows asany
.Swiper version
8.1.3
Platform/Target and Browser Versions
macOS 12.3.1 Visual Studio Code latest
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: