diff --git a/src/js/core/Splide/Splide.ts b/src/js/core/Splide/Splide.ts index f4221201..09f745fa 100644 --- a/src/js/core/Splide/Splide.ts +++ b/src/js/core/Splide/Splide.ts @@ -8,7 +8,7 @@ import { CREATED, DESTROYED, IDLE, STATES } from '../../constants/states'; import { FADE } from '../../constants/types'; import { EventInterface, EventInterfaceObject, State, StateObject } from '../../constructors'; import { Fade, Slide } from '../../transitions'; -import { AnyFunction, ComponentConstructor, Components, EventMap, Options, SyncTarget } from '../../types'; +import { AnyFunction, ComponentConstructor, Components, EventMap, Options, SliderType, SyncTarget } from '../../types'; import { addClass, assert, assign, empty, forOwn, getAttribute, isString, merge, query, slice } from '../../utils'; import { ARIA_LABEL, ARIA_LABELLEDBY } from '../../constants/attributes'; @@ -323,7 +323,7 @@ export class Splide { * * @return `true` if the type matches the current one, or otherwise `false`. */ - is( type: string ): boolean { + is( type: SliderType ): boolean { return this._o.type === type; } diff --git a/src/js/types/general.ts b/src/js/types/general.ts index 5a0ebbbb..238f4414 100644 --- a/src/js/types/general.ts +++ b/src/js/types/general.ts @@ -17,6 +17,13 @@ export type AnyFunction = ( ...args: any[] ) => any; */ export type ComponentConstructor = ( Splide: Splide, Components: Components, options: Options ) => BaseComponent; +/** + * The type for a slider. + * + * @since 4.1.5 + */ +export type SliderType = 'slide' | 'loop' | 'fade'; + /** * The interface for any component. * diff --git a/src/js/types/options.ts b/src/js/types/options.ts index 03fabaf8..9dbd5dd8 100644 --- a/src/js/types/options.ts +++ b/src/js/types/options.ts @@ -1,4 +1,5 @@ import { I18N } from '../constants/i18n'; +import { SliderType } from './general'; /** @@ -13,7 +14,7 @@ export interface Options extends ResponsiveOptions { * - 'loop' : A carousel slider * - 'fade' : A slider with the fade transition. This does not support the perPage option. */ - type?: string; + type?: SliderType; /** * The `role` attribute for the root element.