【发布时间】:2019-01-03 00:59:14
【问题描述】:
我正在尝试在我的项目中从@types/webgl2 导入一些类型。
我遵循了这里提到的每一条建议:
TypeScript typings give me "index.d.ts is not a module"
将此添加到顶部:import 'webgl2';
- 我已确定“
modeResolution”在tsconfig.json中是“true” - 我在
tsconfig.json中添加了一行"types":["webgl2"] - 在
package.json中将"@types/webgl2": "0.0.4"添加到devDependencies和dependencies。 - 是否在我的项目文件夹中安装了 npm:
npm WARN package.json webgl@0.0.1 No README data npm WARN package.json Dependency '@types/webgl2' exists in both dependencies and devDependencies, using '@types/webgl2@0.0.4' from dependencies
我可以很容易地在node_modules/@types 中看到webgl2,并且我还可以在下面看到所有错误符号的声明:
declare var WebGl2RenderingContext {
我仍然收到这些错误:
(multiple lines)
Cannot find name 'WebGl2RenderingContext'. Did you mean 'WebGL2RenderingContext'?
对应于:
const format = WebGl2RenderingContext.RED;
【问题讨论】:
标签: node.js typescript webgl2