From 068ee68c55d8f62167af015fc2d57db8af439003 Mon Sep 17 00:00:00 2001 From: Magdalena Bober <33430525+Magda98@users.noreply.github.com> Date: Tue, 25 Jul 2023 10:27:25 +0200 Subject: [PATCH] feat(types): make VirtualOptions generic (#6852) --- src/types/modules/virtual.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/types/modules/virtual.d.ts b/src/types/modules/virtual.d.ts index 5ffabe1c6..bcf27bd60 100644 --- a/src/types/modules/virtual.d.ts +++ b/src/types/modules/virtual.d.ts @@ -1,4 +1,4 @@ -export interface VirtualMethods { +export interface VirtualMethods { /** * Object with cached slides HTML elements */ @@ -17,7 +17,7 @@ export interface VirtualMethods { /** * Array with slide items passed by `virtual.slides` parameter */ - slides: any[]; + slides: T[]; /* * Methods @@ -59,7 +59,7 @@ export interface VirtualMethods { export interface VirtualEvents {} -export interface VirtualData { +export interface VirtualData { /** * slides left/top offset in px */ @@ -75,10 +75,10 @@ export interface VirtualData { /** * array with slide items to be rendered */ - slides: any[]; + slides: T[]; } -export interface VirtualOptions { +export interface VirtualOptions { /** * Whether the virtual slides are enabled * @@ -90,7 +90,7 @@ export interface VirtualOptions { * * @default [] */ - slides?: any[]; + slides?: T[]; /** * Enables DOM cache of rendering slides html elements. Once they are rendered they will be saved to cache and reused from it. * @@ -114,7 +114,7 @@ export interface VirtualOptions { * * @default null */ - renderSlide?: (slide: any, index: any) => any | null; + renderSlide?: (slide: T, index: any) => any | null; /** * Function for external rendering (e.g. using some other library to handle DOM manipulations and state like React.js or Vue.js). As an argument it accepts `data` object with the following properties: * @@ -125,7 +125,7 @@ export interface VirtualOptions { * * @default null */ - renderExternal?: (data: VirtualData) => any | null; + renderExternal?: (data: VirtualData) => any | null; /** * When enabled (by default) it will update Swiper layout right after renderExternal called. Useful to disable and update swiper manually when used with render libraries that renders asynchronously *