簡體   English   中英

openLayers的打字稿定義

[英]typescript definitions for openLayers

這是我需要在打字稿代碼中使用的功能:

ol.inherits(child, parent);

如何在OpenLayers.d.ts文件中為該函數添加定義?

https://github.com/borisyankov/DefinitelyTyped/blob/master/openlayers/openlayers.d.ts

預先感謝您的任何幫助!

未經測試的樣本,但可能的候選者:

declare module OpenLayers {
    export function inherits(child:any,base:any);
}

如果您設法使用此功能,則將接受Pull Request +測試。

PS:

我建議使用extends關鍵字,而不要為inherits函數而煩惱,因為它將為您提供更好的類型安全性。 例如

class FooLayer extends OpenLayers.Layer{
}

暫無
暫無

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

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