简体   繁体   中英

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

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>;

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM