我正在尝试从@types/webgl2
我的项目中导入一些类型。我遵循了这里提到的每一条建议:
TypeScript Typings give me "index.d.ts is not a module"
将此添加到顶部:import 'webgl2';
- 我已经确定“
modeResolution
”是“true
”在tsconfig.json
- 我
"types":["webgl2"]
在我的tsconfig.json
- 添加
"@types/webgl2": "0.0.4"
到devDependencies
和dependencies
中package.json
。 - 在我的项目文件夹中安装了 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
我可以很容易地看到webgl2
,node_modules/@types
我还可以在下面看到所有错误符号的声明:
declare var WebGl2RenderingContext {
我仍然收到这些错误:
(multiple lines)
Cannot find name 'WebGl2RenderingContext'. Did you mean 'WebGL2RenderingContext'?
对应:
const format = WebGl2RenderingContext.RED;