簡體   English   中英

jQuery打字稿定義文件給出錯誤

[英]jquery typescript definition file gives error

我在同一解決方案中有2個Visual Studio項目,我已更新到最新的jquery 2-1-3和打字稿定義2-2-3,但出現錯誤,生成:接口'JQueryPromise'錯誤地擴展了接口'JQueryGenericPromise

有趣的是,我只在一個項目中遇到此錯誤。 任何想法謝謝

遇到相同的問題,我所做的是將以下行復制到“接口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>;

發生相同的錯誤,但是如果我也使用kendo.all.d.ts,我的kendo版本是: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>;
//}

此解決方案基於DefinitelyTyped的問題3976

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM