该表达式不可构造。输入“typeof import(”jspdf”)”没有构造签名
我正在使用 jsPDF v1.5.3
我已经导入它像这样
import * as jsPDF from 'jspdf'
,在方法我有这个
var doc = new jsPDF('l', 'pt', [175, 91])
但是我有此处类型错误
而且我也声明了这样的@types/jspdf模块,
declare module 'jspdf'{
}
我该如何修复这个?
I am using jsPDF v1.5.3
I have imported it like this
import * as jsPDF from 'jspdf'
and in method I have this
var doc = new jsPDF('l', 'pt', [175, 91])
But I have type error here
and also I have declared @types/jspdf module like this
declare module 'jspdf'{
}
how can I fix this ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不需要这个通配符导入:
你可以只使用命名导入:
如果你想要通配符导入,你必须使用:
这是多余的
This wildcard import is not needed:
You can just use a named import:
If you want the wildcard import anyways, you have to use:
which is redundant ????
对于发现这个问题的其他人(或未来的我),另一个解决方案可能是在您的 tsconf.json 中设置此属性:
"module": "commonjs"
。For anybody else (or future me) who finds this question, another solution could be in your
tsconf.json
setting this property:"module": "commonjs"
.