Skip to content
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

Type arguments for WebGLRenderingContext.uniform*fv as ArrayLike<number> instead of number[] #14925

Closed
jkieboom opened this issue Mar 30, 2017 · 4 comments
Assignees
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@jkieboom
Copy link

The uniform*fv methods on WebGLRenderingContext currently accept a Float32Array | number[], however it would be nicer if they could accept Float32Array | ArrayLike<number>. The webgl specification gives two signatures for these methods, one accepting a Float32Array and another accepting a sequence<GLFloat>. Hence it doesn't require an actual array, just something that may be indexed. ArrayLike<number> seems like a better fit.

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)

Code

function applyUniforms(v: ArrayLike<number>) {
  // Cannot pass v to uniform4fv and friends
  gl.uniform4fv(location, v);
}

Expected behavior:

I expected that I could, the webgl specification does not require this to be an actual array, it says sequence<GLFloat>.

Actual behavior:

It refuses to compile and I need to cast v.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label May 24, 2017
@mhegazy mhegazy added Bug A bug in TypeScript Help Wanted You can do this Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript and removed Needs Investigation This issue needs a team member to investigate its status. labels Feb 9, 2018
@mhegazy mhegazy added this to the Community milestone Feb 9, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Feb 9, 2018

PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.

@lankaapura
Copy link
Contributor

@mhegazy I'd like to work on this. Can you confirm following is correct?

  1. PR to Microsoft/TSJS-lib-generator to update dom.generated.d.ts, webworker.generated.d.ts and dom.es6.generated.d.ts
  2. updating method signatures of uniform* in lib.d.ts and lib.*.d.ts files except for above files
  3. Do I need to do any modifications in tests\lib\lib.d.ts?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 9, 2018

PR to Microsoft/TSJS-lib-generator to update dom.generated.d.ts, webworker.generated.d.ts and dom.es6.generated.d.ts

you want to update the input files like https://github.com/Microsoft/TSJS-lib-generator/blob/master/inputfiles/overridingTypes.json, then rerun the script. you then need to update baseline* with your local generated* and send a PR.

@lankaapura
Copy link
Contributor

Thanks @mhegazy, Create PR microsoft/TypeScript-DOM-lib-generator#368 for this. Let me know if there any issues.

@mhegazy mhegazy added the Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet label Feb 10, 2018
@mhegazy mhegazy self-assigned this Feb 10, 2018
@mhegazy mhegazy modified the milestones: Community, TypeScript 2.8 Feb 10, 2018
@mhegazy mhegazy reopened this Feb 10, 2018
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Feb 12, 2018
@mhegazy mhegazy removed the Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet label Feb 12, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

4 participants