GSAP
GSAP copied to clipboard
context.add typing issue
I believe there is a typing issue with the Context
interface in gsap-core.d.ts
interface Context {
...
add(methodName: string, func: Function, scope?: Element | string | object): Function;
add(func: Function, scope?: Element | string | object): void;
...
}
As I understand it the second overload (adding to the context immediately) should return the 'return value' of the function passed to func
i.e.
interface Context {
...
add(methodName: string, func: Function, scope?: Element | string | object): Function;
- add(func: Function, scope?: Element | string | object): void;
+ add<T extends Function>(func: T, scope?: Element | string | object): ReturnType<T>;
...
}
Or at least thats the way it works for me :)
Zak.