【发布时间】:2021-05-14 20:09:05
【问题描述】:
我正在使用 TypeScript 为我的应用编写一些 Canvas 代码并收到以下错误:
Property 'wrapText' does not exist on type 'CanvasRenderingContext2D'.ts(2339)
这是从这条线上来的:
CanvasRenderingContext2D.prototype.wrapText = function(text, x, y, maxWidth, lineHeight)
我想我可以在 lib.dom.d.ts 文件中添加一个声明,该文件位于 VS Code 的 node_modules 扩展部分中。这是修复它的唯一方法吗?我很好奇为什么不包括在内。我正在运行 2021 年 4 月版的 VS Code,因为我刚刚升级了它。
【问题讨论】:
标签: typescript dom visual-studio-code canvas