的任何簽名我有這樣的代碼(修整):打字稿:構建:提供的參數不匹配,調用對象的
class cSubjectSite {
collectionHomeMarker: Microsoft.Maps.EntityCollection;
showAddressMarker() {
var opts: Microsoft.Maps.EntityCollectionOptions = {
zIndex: zIndex_HomeMarker, bubble: true, visible: true
};
}
// Compiler error on this line:
this.collectionHomeMarker = new Microsoft.Maps.EntityCollection(opts);
}
這對我來說很好。這裏的報關Microsoft.Maps.d.ts:
export interface EntityCollectionOptions {
bubble?: boolean;
visible?: boolean;
zIndex?: number;
}
export class EntityCollection implements Entity {
EntityCollection(options?: EntityCollectionOptions);
// Etc.
還有我使用(Microsoft.Maps.AdvancedShapes.d.ts)對於具有另一種定義爲EntityCollection擴展功能的第二個聲明文件:
export class EntityCollection implements Entity {
constructor(options?: EntityCollectionOptions);
它看起來像兩個def文件針對不同的ts版本(不同的構造函數語法)?我對def文件不夠了解。
我使用VS 2013與ts 1.5。我確保我的路徑變量和我的proj文件都參考v1.5。我從Nuget獲得了Bing Maps def文件。
我是新來的打字稿,所以我可能會缺少一些基本的東西。
- 布拉德
def文件來自[DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped)。沒有Microsoft.Maps.EntityCollectionOptions,但有一個[Microsoft.Maps.EntityCollectionOptions對象](https://msdn.microsoft.com/en-us/library/gg427614.aspx),因此def文件包含它用於打字目的。我不知道它的包裝效果如何,這就是爲什麼我將def文件包含在def文件中,以便有人可以看到是否有錯誤。 –