Closed
Description
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
.