From 503ba49983bed8c7221d080807eba97df2864d87 Mon Sep 17 00:00:00 2001 From: Hodzic Adem Date: Sun, 17 Feb 2019 14:43:09 +0100 Subject: [PATCH] Fixed error where I declared ...args as type any instead of any[] --- types/gsap/Animation.d.ts | 4 ++-- types/gsap/Ease.d.ts | 2 +- types/gsap/Timeline.d.ts | 14 +++++++------- types/gsap/Tween.d.ts | 14 +++++++------- types/gsap/TweenConfig.d.ts | 12 ++++++------ types/gsap/gsap-tests.ts | 11 +++++------ 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/types/gsap/Animation.d.ts b/types/gsap/Animation.d.ts index c5f4449ea3..1c26798810 100644 --- a/types/gsap/Animation.d.ts +++ b/types/gsap/Animation.d.ts @@ -29,8 +29,8 @@ declare namespace gsap { * Gets or sets an event callback like "onComplete", "onUpdate", "onStart", "onReverseComplete" or "onRepeat" (onRepeat only applies to TweenMax or TimelineMax instances) along with any * parameters that should be passed to that callback. */ - eventCallback(type: string): (...args: any) => void; - eventCallback(type: string, callback: (...args: any) => void, params?: any[], scope?: any): Animation; + eventCallback(type: string): (...args: any[]) => void; + eventCallback(type: string, callback: (...args: any[]) => void, params?: any[], scope?: any): Animation; /** * Clears any initialization data (like starting/ending values in tweens) which can be useful if, for example, you want to restart a tween without reverting to any previously recorded diff --git a/types/gsap/Ease.d.ts b/types/gsap/Ease.d.ts index fe25a11c74..a7c594ef41 100644 --- a/types/gsap/Ease.d.ts +++ b/types/gsap/Ease.d.ts @@ -1,6 +1,6 @@ declare namespace gsap { class Ease { - constructor(func?: (...args: any) => void, extraParams?: any[], type?: number, power?: number); + constructor(func?: (...args: any[]) => void, extraParams?: any[], type?: number, power?: number); /** Translates the tween's progress ratio into the corresponding ease ratio. */ getRatio(p: number): number; diff --git a/types/gsap/Timeline.d.ts b/types/gsap/Timeline.d.ts index b859a2e803..74b9e50396 100644 --- a/types/gsap/Timeline.d.ts +++ b/types/gsap/Timeline.d.ts @@ -31,13 +31,13 @@ declare namespace gsap { addLabel(label: string, position: any): TimelineLite; /** Inserts a special callback that pauses playback of the timeline at a particular time or label. */ - addPause(position?: any, callback?: (...args: any) => void, params?: any[], scope?: any): TimelineLite; + addPause(position?: any, callback?: (...args: any[]) => void, params?: any[], scope?: any): TimelineLite; /** * Adds a callback to the end of the timeline (or elsewhere using the "position" parameter) - this is a convenience method that accomplishes exactly the same thing as * add( TweenLite.delayedCall(...) ) but with less code. */ - call(callback: (...args: any) => void, params?: any[], scope?: any, position?: any): TimelineLite; + call(callback: (...args: any[]) => void, params?: any[], scope?: any, position?: any): TimelineLite; /** Empties the timeline of all tweens, timelines, and callbacks (and optionally labels too). */ clear(labels?: boolean): TimelineLite; @@ -106,7 +106,7 @@ declare namespace gsap { vars: {}, stagger?: number, position?: any, - onCompleteAll?: (...args: any) => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteScope?: any ): TimelineLite; @@ -122,7 +122,7 @@ declare namespace gsap { toVars: {}, stagger?: number, position?: any, - onCompleteAll?: (...args: any) => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): TimelineLite; @@ -137,7 +137,7 @@ declare namespace gsap { vars: {}, stagger: number, position?: any, - onCompleteAll?: (...args: any) => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): TimelineLite; @@ -156,14 +156,14 @@ declare namespace gsap { class TimelineMax extends TimelineLite { constructor(vars?: {}); - addCallback(callback: (...args: any) => void, position: any, params?: any[], scope?: any): TimelineMax; + addCallback(callback: (...args: any[]) => void, position: any, params?: any[], scope?: any): TimelineMax; currentLabel(): string; currentLabel(value: string): TimelineMax; getActive(nested?: boolean, tweens?: boolean, timelines?: boolean): Tween | Timeline[]; getLabelAfter(time: number): string; getLabelBefore(time: number): string; getLabelsArray(): Array<{ name: string; time: number }>; - removeCallback(callback: (...args: any) => void, timeOrLabel?: any): TimelineMax; + removeCallback(callback: (...args: any[]) => void, timeOrLabel?: any): TimelineMax; removePause(position: any): TimelineMax; repeat(): number; repeat(value: number): TimelineMax; diff --git a/types/gsap/Tween.d.ts b/types/gsap/Tween.d.ts index 404daef039..3dd15ca685 100644 --- a/types/gsap/Tween.d.ts +++ b/types/gsap/Tween.d.ts @@ -22,7 +22,7 @@ declare namespace gsap { static ticker: any; /** Provides a simple way to call a () => void after a set amount of time (or frames). */ - static delayedCall(delay: number, callback: (...args: any) => void, params?: any[], scope?: any, useFrames?: boolean): TweenLite; + static delayedCall(delay: number, callback: (...args: any[]) => void, params?: any[], scope?: any, useFrames?: boolean): TweenLite; /** * Static method for creating a TweenLite instance that tweens backwards - you define the BEGINNING values and the current values are used as the destination values which is great for doing @@ -49,7 +49,7 @@ declare namespace gsap { invalidate(): TweenLite; /** Immediately kills all of the delayedCalls to a particular () => void. */ - static killDelayedCallsTo(func: (...args: any) => void): void; + static killDelayedCallsTo(func: (...args: any[]) => void): void; /** Kills all the tweens (or specific tweening properties) of a particular object or delayedCalls to a particular () => void. */ static killTweensOf(target: any, onlyActive?: boolean, vars?: any): void; @@ -74,7 +74,7 @@ declare namespace gsap { constructor(target: {}, duration: number, vars: {}); /** Provides a simple way to call a () => void after a set amount of time (or frames). */ - static delayedCall(delay: number, callback: (...args: any) => void, params?: any[], scope?: {}, useFrames?: boolean): TweenMax; + static delayedCall(delay: number, callback: (...args: any[]) => void, params?: any[], scope?: {}, useFrames?: boolean): TweenMax; /** * Static method for creating a TweenMax instance that tweens backwards - you define the BEGINNING values and the current values are used as the destination values which is great for @@ -110,7 +110,7 @@ declare namespace gsap { static killChildTweensOf(parent: any, complete?: boolean): void; /** Immediately kills all of the delayedCalls to a particular () => void. */ - static killDelayedCallsTo(func: (...args: any) => void): void; + static killDelayedCallsTo(func: (...args: any[]) => void): void; /** Kills all the tweens (or specific tweening properties) of a particular object or the delayedCalls to a particular () => void. */ static killTweensOf(target: {}, vars?: {}): void; @@ -144,7 +144,7 @@ declare namespace gsap { duration: number, vars: {}, stagger: number, - onCompleteAll?: (...args: any) => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): any[]; @@ -159,7 +159,7 @@ declare namespace gsap { fromVars: {}, toVars: {}, stagger: number, - onCompleteAll?: (...args: any) => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): any[]; @@ -173,7 +173,7 @@ declare namespace gsap { duration: number, vars: {}, stagger: number, - onCompleteAll?: (...args: any) => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): any[]; diff --git a/types/gsap/TweenConfig.d.ts b/types/gsap/TweenConfig.d.ts index 8a1698efaa..9912613694 100644 --- a/types/gsap/TweenConfig.d.ts +++ b/types/gsap/TweenConfig.d.ts @@ -23,7 +23,7 @@ declare namespace gsap { overwrite?: string | number; /** A () => void that should be called when the animation has completed. */ - onComplete?: (...args: any) => void; + onComplete?: (...args: any[]) => void; /** An Array of parameters to pass the onComplete () => void */ onCompleteParams?: any[]; @@ -39,7 +39,7 @@ declare namespace gsap { immediateRender?: boolean; /** A () => void that should be called when the tween has reached its beginning again from the reverse direction. */ - onReverseComplete?: (...args: any) => void; + onReverseComplete?: (...args: any[]) => void; /** An Array of parameters to pass the onReverseComplete () => void. */ onReverseCompleteParams?: any[]; @@ -48,7 +48,7 @@ declare namespace gsap { onReverseCompleteScope?: {}; /** A () => void that should be called when the tween begins (when its time changes from 0 to some other value which can happen more than once if the tween is restarted multiple times). */ - onStart?: (...args: any) => void; + onStart?: (...args: any[]) => void; /** An Array of parameters to pass the onStart () => void. */ onStartParams?: any[]; @@ -57,7 +57,7 @@ declare namespace gsap { onStartScope?: {}; /** A () => void that should be called every time the animation updates (on every frame while the animation is active). */ - onUpdate?: (...args: any) => void; + onUpdate?: (...args: any[]) => void; /** An Array of parameters to pass the onUpdate () => void. */ onUpdateParams?: any[]; @@ -81,7 +81,7 @@ declare namespace gsap { lazy?: boolean; /** A () => void that should be called when the tween gets overwritten by another tween. */ - onOverwrite?: (...args: any) => void; + onOverwrite?: (...args: any[]) => void; /** If true atuomatically populates the css property for tween on DOM elements */ autoCSS?: boolean; @@ -95,7 +95,7 @@ declare namespace gsap { repeatDelay?: number; - onRepeat?: (...args: any) => void; + onRepeat?: (...args: any[]) => void; onRepeatScope?: {}; } diff --git a/types/gsap/gsap-tests.ts b/types/gsap/gsap-tests.ts index 63a06e10b8..411ca19d0c 100644 --- a/types/gsap/gsap-tests.ts +++ b/types/gsap/gsap-tests.ts @@ -1,13 +1,13 @@ import { TweenLite, TweenMax } from 'gsap'; const callbackWithoutParams = () => { - console.log('I Have No Parameters.') -} + console.log('I Have No Parameters.'); +}; -const callbackWithParams = (...args: any) => { - console.log('I Have Parameters.') +const callbackWithParams = (...args: any[]) => { + console.log('I Have Parameters.'); console.log(args); -} +}; const tweenLiteExample = TweenLite @@ -30,4 +30,3 @@ const tweenMaxExample = TweenMax onCompleteParams: ['foo', 'bar'] }) .seek(0.5); -