-
Notifications
You must be signed in to change notification settings - Fork 447
Allow GLBoolean in pixelStorei #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The reason for this change is that while the GL spec specifies the type for |
Is it possible to use overloads to enforce the correct type based on the specific parameter being set? That would be ideal if it's possible to do so. |
I don't know how I could do that - any ideas? |
You’d have to use literal types, but this requires the value of the GLenum constants to be known at compile time - if they aren’t compile-time constants (e.g. members of an Just to illustrate the concept if you aren’t familiar with it: func(control: 0, value: number);
func(control: 1, value: string); So for the above function, if you pass 0 as the first arg, the second must be a number, if the first arg is 1 you have to pass a string. I have a feeling the |
@fatcerberus I looked at WebGl 1.widl and it defines GLenum as I would also need to find out if widl supports overloads discriminated by integer literal types. If not, then the change would have to go in overridingTypes.json (I think). @AVGP It turns out that this change WAS in dom.generated.d.ts, but it got lost when we switched away from IE's idl files to standard ones. Can you just copy the change from #178 instead of adding an overload? I think it's better for the simple fix. |
@@ -653,6 +653,7 @@ interface mixin WebGLRenderingContextBase | |||
void lineWidth(GLfloat width); | |||
void linkProgram(WebGLProgram program); | |||
void pixelStorei(GLenum pname, GLint param); | |||
void pixelStorei(GLenum pname, GLboolean param); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDL files shouldn't be manually changed, instead overridingTypes.json can.
This is deprecated by #638 |
related to microsoft/TypeScript#27542