openLayers的打字稿定义

时间:2014-09-22 07:09:26

标签: typescript openlayers

这是我需要在打字稿代码中使用的函数:

ol.inherits(child, parent);

如何在OpenLayers.d.ts文件中添加该功能的定义?

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

提前感谢您的帮助!

1 个答案:

答案 0 :(得分:2)

未经测试的样本,但可能是候选人:

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

如果您设法使用此功能,欢迎使用Pull Request +测试。

PS:

我建议使用extends关键字,而不是打扰inherits功能,因为它会为您提供更好的类型安全性。例如

class FooLayer extends OpenLayers.Layer{
}