Cannot find name 'WebGL2RenderingContext'

Here is a solution that I found, after quite a lot of struggle…
I had, in my tsconfig.app.json, under the CompilerOptions tag

"types": [
    "node"
]

After Installing @types/webgl2, I did not add it to tsconfig.app.json, so Angular could not find the WebGL2RenderingContext declaration.
All I had to do is install @types/webgl2 with npm, and put the following in my tsconfig.app.json, onder the CompilerOptions tag:

"types": [
    "node",
    "webgl2"
]

Now it seem to work ok.

3 Likes