简体   繁体   English

jQuery打字稿定义文件给出错误

[英]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 我在同一解决方案中有2个Visual Studio项目,我已更新到最新的jquery 2-1-3和打字稿定义2-2-3,但出现错误,生成:接口'JQueryPromise'错误地扩展了接口'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. 遇到相同的问题,我所做的是将以下行复制到“接口JQueryPromise扩展JQueryGenericPromise”块的底部。

/**
 * 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 发生相同的错误,但是如果我也使用kendo.all.d.ts,我的kendo版本是:2015.1.408

Commenting out the conflicting declaration in kendo.all.d.ts solves this issue with minimal impact: 注释掉kendo.all.d.ts中的冲突声明可以以最小的影响解决此问题:

// 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 此解决方案基于DefinitelyTyped的问题3976

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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