Trying to convert JQuery plugin to TypeScript

I'm trying to convert this JQuery plugin to typescript:

But I'm not able to get Intellisense to recognize the function in typescript. I just need one function from the this plugin - "ajaxSubmit". I've declared it i a .d.ts file in my typescript project and added a reference to it from the main file. However, Webstorm does not seem to know that function and throws an error. Here's the .d.ts

interface JQuery
    ajaxSubmit(error:any, success:any): JQuery;

I've taken a look at this page and tried to follow the intruction in there.

Using jQuery plugin in TypeScript

Here's the program that implements AjaxSubmit. Webstorm throws an error that says: $(this) : Argument does not match parameters.

var $form = $("#fileUploadForm");
    $form.submit(function (e) {
        // perform client side validations if any

            error: function () {
                // handle error

            success: function (response) {
                // handle success

        // Important: stop event propagation
        return false;

By the way, I'm using NodeJS + ExpressJs in the back end, I dont think it concerns this question.


Based on your code sample the signature should be:

interface JQuery
    ajaxSubmit(arg:{error:any, success:any}): JQuery;

Changing "$(this)" to "$form" or just "this" works.

Nuget has a TypeScript definition for the jquery forms plugin:


 ? Cannot extend angularjs controller in typescript
 ? Angular2 routing : redirectTo a relative url
 ? Angular 2 - Check current active route "name"
 ? Manually changing the route parameters leads to inconsistent user interface
 ? knockout - trying to use data from 2 data sets in my view
 ? PostgreSQL: Converting data file string to epoch time
 ? PyQT5 and Python3 "exit(a.exec_())" NameError: name 'a' is not defined
 ? Interfaces in Class Files
 ? Static map in class - public or private?
 ? Saving, getting and setting length of a cube (extending classes)