Skip to content

Commit 5d91e6e

Browse files
authored
fix(types): Add autoScroll to thumbs.update type signature (#8146)
* fix(types): Add `autoScroll` to `thumbs.update` type signature * support calling `update(true, { otherOption: true })` to support adding more parameters in the future. `autoScroll` will be `true` by default when `p` is `undefined` or `{}`
1 parent d18ad06 commit 5d91e6e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/modules/thumbs/thumbs.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default function Thumb({ swiper, extendParams, on }) {
9393
return true;
9494
}
9595

96-
function update(initial, p = { autoScroll: true }) {
96+
function update(initial, p) {
9797
const thumbsSwiper = swiper.thumbs.swiper;
9898
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
9999

@@ -129,7 +129,7 @@ export default function Thumb({ swiper, extendParams, on }) {
129129
}
130130
}
131131

132-
if (p.autoScroll) {
132+
if (p?.autoScroll ?? true) {
133133
autoScroll(initial ? 0 : undefined);
134134
}
135135
}

src/types/modules/thumbs.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface ThumbsMethods {
99
/**
1010
* Update thumbs
1111
*/
12-
update(initial: boolean): void;
12+
update(initial: boolean, p?: { autoScroll?: boolean }): void;
1313

1414
/**
1515
* Initialize thumbs

0 commit comments

Comments
 (0)