Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

context.add typing issue #592

Open
zakuk opened this issue Sep 5, 2024 · 0 comments
Open

context.add typing issue #592

zakuk opened this issue Sep 5, 2024 · 0 comments

Comments

@zakuk
Copy link

zakuk commented Sep 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant