You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The auto-generated typings would need to be excluded. Maybe this should be added as a separate option for the lib compiler option as it's not exactly lightweight.
I might have made some of the types too strict, for example for texImage2D I added overloads which exactly match the internalFormat/format/type combinations allowed by the WebGL spec. When calling the function with immediate values, this is fine, but calling it with values in variables is going to require as any casts. (Which could be fine, as at that point you're responsible for the correct types anyway).
Also the following would fail, because TS doesn't currently generate a common supertype (?).
declareconstrandomParameter: GL['ACTIVE_TEXTURE']|GL['ALIASED_LINE_WIDTH_RANGE']constx=gl.getParameter(randomParameter)// no matching overload, but a return type of GL.TextureUnits | Float32Array would make sense.
Is adding the .d.ts files as additional inputFiles which are concatenated to the dom.generated.d.ts (or a separate webgl lib file) an option? I added a number of subtypes which are only implicitly in the spec: all constants are typed as a generic GLenum in spec, although there are many different subgroups which I typed explicitly. It is highly unlikely that those will be added to the IDL.
The text was updated successfully, but these errors were encountered:
Opening a new issue, as requested. See also microsoft/TypeScript#21902.
I wrote some strict types for WebGL/WebGL2, which would fix microsoft/TypeScript#5855 among others. See https://github.com/Microsoft/TypeScript/pull/21902/files.
The auto-generated typings would need to be excluded. Maybe this should be added as a separate option for the
lib
compiler option as it's not exactly lightweight.I might have made some of the types too strict, for example for texImage2D I added overloads which exactly match the internalFormat/format/type combinations allowed by the WebGL spec. When calling the function with immediate values, this is fine, but calling it with values in variables is going to require
as any
casts. (Which could be fine, as at that point you're responsible for the correct types anyway).Also the following would fail, because TS doesn't currently generate a common supertype (?).
Is adding the .d.ts files as additional inputFiles which are concatenated to the dom.generated.d.ts (or a separate webgl lib file) an option? I added a number of subtypes which are only implicitly in the spec: all constants are typed as a generic GLenum in spec, although there are many different subgroups which I typed explicitly. It is highly unlikely that those will be added to the IDL.
The text was updated successfully, but these errors were encountered: