JQueryPromise and arrays

Topics: General
Jan 8, 2014 at 12:40 AM
Edited Jan 8, 2014 at 12:42 AM
The following function doesn't compile. It looks like a jquery.d.ts issue.
    static testit() {
        return $.when(4)
            .then(x => $.when(['a', 'b']))
            .then(y => y.length);
    }
Coordinator
Jan 8, 2014 at 3:30 PM
Which jquery.d.ts are you using? There is one in the TypeScript source repo, which is currently out-of-date, and a more up-to-date one in the DefinitelyTyped repo.
Jan 8, 2014 at 8:31 PM
Yes I'm using the latest jquery.d.ts and ts 0,9.5.


j
Jan 9, 2014 at 9:42 PM
Seems like the bug can be fixed changing the order of this
    then<U>(onFulfill: (value: T) => U, onReject?: ....): JQueryPromise<U>;
    then<U>(onFulfill: (value: T) => JQueryGenericPromise<U>, onReject?: .... ): JQueryPromise<U>;
to this:
    then<U>(onFulfill: (value: T) => JQueryGenericPromise<U>, onReject?: .... ): JQueryPromise<U>;
    then<U>(onFulfill: (value: T) => U, onReject?: ....): JQueryPromise<U>;