【问题标题】:typescript definitions for openLayersopenLayers 的打字稿定义
【发布时间】: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


【解决方案1】:

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

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

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

PS:

我建议使用extends 关键字,而不要使用inherits 函数,因为它会为您提供更好的类型安全性。例如

class FooLayer extends OpenLayers.Layer{
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-20
    • 1970-01-01
    • 2018-06-05
    • 2012-11-06
    • 2023-04-02
    • 2016-08-13
    • 1970-01-01
    相关资源
    最近更新 更多