我想使用内联样式前缀,例如:
var InlineStylePrefixer = require('inline-style-prefixer');
...
var prefixer = new InlineStylePrefixer(userAgent);
...
var _style = InlineStylePrefixer.prefixAll(style);
如何在声明模块中导出构造函数?
declare module "inline-style-prefixer"{
export function InlineStylePrefixer(useagent:string):void; // error
export function prefixAll(style:Object):Object;
}
你会做两/三个声明:
declare class InlineStylePrefixer {
constructor(useagent: string) {}
}
declare module InlineStylePrefixer {
export function prefixAll(style: Object): Object;
}
declare module "inline-style-prefixer" {
export = InlineStylePrefixer;
}
当类和模块同名时,模块将与类合并。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)