jquery typescript定义文件给出错误

时间:2015-03-28 18:19:17

标签: jquery typescript

我在同一个解决方案中有2个Visual Studio项目,我已更新到最新的jquery 2-1-3和打字稿定义2-2-3,但是我收到错误, 构建:界面' JQueryPromise'错误地扩展了界面' JQueryGenericPromise

有趣的是我只在一个项目中得到这个错误。 任何想法谢谢

2 个答案:

答案 0 :(得分:3)

有同样的问题,我所做的是将以下行复制到“JQueryPromise extends 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>;

答案 1 :(得分:1)

有同样的错误,但是如果我也使用了kendo.all.d.ts 我的剑道版本是:2015.1.408

在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>;
//}

此解决方案基于issue 3976 at DefinitelyTyped