我在打字稿中声明一个模块:
declare module 'myweb' {
export default class MyWeb {
constructor(url: string);
}
}
当我导入它时import MyWeb from 'myweb';
出现错误TypeError: myweb_1.default is not a constructor
。
它被转换为:
const myweb_1 = require("myweb");
...
new myweb_1.default(url);
对我来说似乎正确。
模块中还有其他导出的元素,所以我不能使用 export =
有任何想法吗?谢谢。
编辑:
javascript本身是我无法更改的库,但是代码是:
var MyWeb = function MyWeb() {
var _this = this;
processParams(this, arguments);
}
module.exports = MyWeb;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句