user971374
user971374

Reputation: 153

jquery typescript definition file gives error

I have 2 Visual studio projects in the same solution, I have updated to the latest jquery 2-1-3 and typescript definition 2-2-3, but I get an error, Build: Interface 'JQueryPromise' incorrectly extends interface 'JQueryGenericPromise

funny thing I only get this error in one project. any ideas thanks

Upvotes: 2

Views: 954

Answers (2)

g.pickardou
g.pickardou

Reputation: 35873

Had the same error, however just in case if I use also the kendo.all.d.ts My kendo version is: 2015.1.408

Commenting out the conflicting declaration in kendo.all.d.ts solves this issue with minimal impact:

// This is line 15266 in my kendo.all.d.ts
//interface JQueryPromise<T> {
//    pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise<T>;
//    then(doneCallbacks: any, failCallbacks: any, progressCallbacks?: any): JQueryPromise<T>;
//}

This solution is based on issue 3976 at DefinitelyTyped

Upvotes: 1

Andreas H&#248;yer
Andreas H&#248;yer

Reputation: 46

Had same problem, what I did was copy the following line to the bottom of the "interface JQueryPromise extends JQueryGenericPromise" block.

/**
 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
 * 
 * @param doneFilter A function that is called when the Deferred is resolved.
 * @param failFilter An optional function that is called when the Deferred is rejected.
 */
then<U>(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise<U>, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise<U>;

/**
 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
 * 
 * @param doneFilter A function that is called when the Deferred is resolved.
 * @param failFilter An optional function that is called when the Deferred is rejected.
 */
then(doneFilter: (value?: T, ...values: any[]) => void, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise<void>;

Upvotes: 3

Related Questions