TypeScript 声明文件:命名空间中的函数

TypeScript Declaration File: Function in namespace

我在我的一个项目中使用 OpenLayers 3,并从 DefinitelyTyped (Definition File), but some functions are missing, which I have to manually add in the declaration file. One of them is the ol.inherits-functions (OpenLayers 3 API Reference) 检索了 TypeScript 定义文件。

我正在努力定义这个函数,因为 ol 关键字用作名称空间标识符,我无法将函数直接放在名称空间中。

我也试过添加这样的东西,但显然它说 重复标识符

interface olStatic {
   inherits(childCtor: () => any, parentCtor: () => any);
}
declare var ol: olStatic;

我已经为ol3制作了自己的定义文件。我不确定这是否有帮助,但在我自己的文件中,我确实定义了 ol.inherits,如下所示:

declare module ol {

function inherits(arg1:any, arg2:any);
 ........................
export class Collection<T> {
............................