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

How to extend a class, type or interface in an existing flowtype definition file #2421

Closed
doberkofler opened this issue Sep 8, 2016 · 2 comments

Comments

@doberkofler
Copy link

I'm currently using a jQuery flow definition file (https://github.com/marudor/flowInterfaces) and it seems to works great. I would now also need to add definitions for some jQuery plugins and I cannot see how to extend the existing definition with other plugins sharing the jQuery namespace?

More generally asked. If I for example have an existing flowtype definition file like this:

declare class JQueryStatic {
   ajax(url: string, settings?: any): any;
   /* ... */
}
declare var jQuery: JQueryStatic;
declare var $: JQueryStatic;

How can for example add a new function (ajaxsetup(settings: any);) to this class without changing the existing definition file?

I would have hoped, that something like:

declare class JQueryStatic extends JQueryStatic {
   ajaxsetup(settings: any);
}

would work, but do not find anything like this and flow shows the error JQueryStatic name is already bound.

What is the proper way for extending a class, module or type definition in an external flowtype definition file?

@doberkofler doberkofler changed the title How to extend an existing flowtype definition file How to extend a class, type or interface in an existing flowtype definition file Sep 11, 2016
@hon2a
Copy link

hon2a commented Nov 10, 2016

Looks like a duplicate of #396 .

@vkurchatkin
Copy link
Contributor

@hon2a Thanks!

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

No branches or pull requests

3 participants