7 comments
Comment actions Permalink

Please could you elaborate on this? Code snippets plus screenshots illustrating the issue would be helpful

0
Comment actions Permalink

export var gl: WebGL2RenderingContext

const canvas = document.querySelector("#glCanvas") as HTMLCanvasElement
gl = canvas!.getContext("webgl2")!
0
Comment actions Permalink

can't see any problems with this code:

what errors using it have you seen namely?

0
Comment actions Permalink

clone this project https://github.com/duzenko/webgl and open in webstorm

open src/index.ts, wait for it load fully

observer errors

0
Comment actions Permalink

The error comes from the Typescript compiler, not from the IDE; you will face the same issue when running tsc -p . in the command line:

The problem is that you are using a very old Typescript version (2.9.2), and WebGL typings are only included in Typescript since 3.6 (see https://github.com/microsoft/TypeScript/issues/14733#issuecomment-553589617). If upgrading Typescript is not an option, I can only suggest trying the @types/webgl2 (https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webgl2)

0
Comment actions Permalink

I see

However both VisualStudio 2022 and VSCode use system-wide lib.dom.d.ts and not the one from local .node_modules/typescript/lib/lib.dom.d.ts

I think webstorm should comply

-1
Comment actions Permalink

VSCode uses its own Typescript version by default; Webstorm also bundles Typescript with it, you can use the bundled  version if you like (can be chosen in Settings | Languages & Frameworks | TypeScript, TypeScript). But using project local version (if any) is preferable, as it's the version used in your project, the one you will use for building it. So I'd strongly recommend updating your project dependencies instead of relying on bundled libraries

1

Please sign in to leave a comment.