exports = struct, struct 是一个方法, 这种怎么定义 typescript 的 d.ts 文件

像这种 怎么定义 d.ts 文件。

module.exports = Struct

/**
 * The Struct "type" meta-constructor.
 */

function Struct () {
  debug('defining new struct "type"')
  ...
}

我这样定义不行

declare module 'ref-struct' {
  function Struct(options?: any): any;
  export = Struct;
}
阅读 4.5k
1 个回答

调用方式不正确哦
请使用import Struct = require('ref-struct');
因为你这边使用的是export = Foo的方式来导出的

推荐问题