Skip to content

Commit

Permalink
fix: 🏷️ fix union type for function
Browse files Browse the repository at this point in the history
  • Loading branch information
thierrymichel committed Jun 25, 2020
1 parent e35baba commit b5f0481
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 10 additions & 9 deletions src/defs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export interface GenericObject {
}

export interface Options {
transition: Transition
transition: Transition['cb']
auto?: boolean
click?: boolean
controls?: boolean | string
Expand Down Expand Up @@ -78,14 +78,15 @@ export type SupportedTypes =
| 'pointerup'
| 'pointermove'

export type TransitionElement = HTMLElement | HTMLElement[]
export type Transition = (
currentSlides: TransitionElement,
newSlides: TransitionElement,
infos: TransitionInfos,
context?: any,
data?: any
) => Promise<any>
export interface Transition {
cb(
currentSlides: HTMLElement | HTMLElement[],
newSlides: HTMLElement | HTMLElement[],
infos: TransitionInfos,
context?: any,
data?: any
): Promise<any>
}

export type HooksNames =
| 'beforeInit'
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Direction, Action, Transition, TransitionInfos } from '../defs'
* Create manager.
*/
export class Manager {
private _transition: Transition
private _transition: Transition['cb']
private _isAnimating = false
private _max: number
private _actions: Action[]
Expand All @@ -14,7 +14,7 @@ export class Manager {
* Creates an instance of Manager.
*/

constructor(private _slidy: Slidy, transition: Transition) {
constructor(private _slidy: Slidy, transition: Transition['cb']) {
this._transition = transition
this._isAnimating = false
this._max = this._slidy.options.queue
Expand Down

0 comments on commit b5f0481

Please sign in to comment.