【发布时间】:2014-11-16 02:01:24
【问题描述】:
这是我需要在打字稿代码中使用的函数:
ol.inherits(child, parent);
如何在 OpenLayers.d.ts 文件中为该函数添加定义?
https://github.com/borisyankov/DefinitelyTyped/blob/master/openlayers/openlayers.d.ts
提前感谢您的帮助!
【问题讨论】:
标签: typescript openlayers
这是我需要在打字稿代码中使用的函数:
ol.inherits(child, parent);
如何在 OpenLayers.d.ts 文件中为该函数添加定义?
https://github.com/borisyankov/DefinitelyTyped/blob/master/openlayers/openlayers.d.ts
提前感谢您的帮助!
【问题讨论】:
标签: typescript openlayers
未经测试的样本,但可能是候选者:
declare module OpenLayers {
export function inherits(child:any,base:any);
}
如果您设法使用此功能,欢迎使用 Pull Request + 测试。
我建议使用extends 关键字,而不要使用inherits 函数,因为它会为您提供更好的类型安全性。例如
class FooLayer extends OpenLayers.Layer{
}
【讨论】: