-
Notifications
You must be signed in to change notification settings - Fork 441
Revert #409? #419
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
Comments
I likely pulled up the W3C specification or an old webaudio.github.com one by mistake. This changed in WebAudio/web-audio-api#1189 My original issue was a warning when passing a Should |
Sequences cannot be used for attributes, so it may make sense. |
@saschanaz what about the other APIs that changed? Maybe the right fix is to revert the change and add a specific override for setValueCurveAtTime. Sorry for making the changes without checking the updated spec |
I think that's all. Full diff: --- a/baselines/dom.generated.d.ts
+++ b/baselines/dom.generated.d.ts
@@ -1033,8 +1033,8 @@ interface PeriodicWaveConstraints {
}
interface PeriodicWaveOptions extends PeriodicWaveConstraints {
- imag?: Float32Array;
- real?: Float32Array;
+ imag?: number[];
+ real?: number[];
}
interface PointerEventInit extends MouseEventInit {
@@ -1569,8 +1569,8 @@ interface VRDisplayEventInit extends EventInit {
}
interface VRLayer {
- leftBounds?: Float32Array | null;
- rightBounds?: Float32Array | null;
+ leftBounds?: number[] | null;
+ rightBounds?: number[] | null;
source?: HTMLCanvasElement | null;
}
@@ -1581,7 +1581,7 @@ interface VRStageParameters {
}
interface WaveShaperOptions extends AudioNodeOptions {
- curve?: Float32Array;
+ curve?: number[];
oversample?: OverSampleType;
}
@@ -1984,7 +1984,7 @@ interface AudioParam {
linearRampToValueAtTime(value: number, endTime: number): AudioParam;
setTargetAtTime(target: number, startTime: number, timeConstant: number): AudioParam;
setValueAtTime(value: number, startTime: number): AudioParam;
- setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): AudioParam;
+ setValueCurveAtTime(values: number[], startTime: number, duration: number): AudioParam;
}
declare var AudioParam: { PeriodicWaveOptions is also from Web Audio. dictionary PeriodicWaveOptions : PeriodicWaveConstraints {
sequence<float> real;
sequence<float> imag;
}; |
That reverts it, but the original issue remains: I'm also not sure what the official policy is regarding specifications that haven't been adopted by all browsers. Firefox and WebKit both require Float32Array and throw an exception on other types. |
Another general solution is creating new WebIDL-compatible The spec says iterable objects can be casted as IDL sequence type, so we may do: type Sequence<T> = T[] | { [Symbol.iterator](): IterableIterator<T> };
// all of the followings should be allowed
declare function receiveNumberSequence(sequence: Sequence<number>): void;
receiveNumberSequence([0]);
receiveNumberSequence(new Set([0]));
receiveNumberSequence(new Uint8Array([0]));
receiveNumberSequence(new Float32Array([0]));
declare function receiveStringMap(map: Sequence<[string, string]>): void;
receiveStringMap(new Map([["abc", "bcd"]]));
receiveStringMap(new URLSearchParams());
receiveStringMap(new Headers()); I have no idea how to make this ES5-compatible though. microsoft/TypeScript#13031 |
ES5 vs ES6 is the issue here.. |
So every use of Looks like all the changes in #409 were in input positions, so the use of union should be fine. |
For now, yes.
|
Is Chrome appears to accept Float64Array and Int16Array values for |
That's the intended behavior, but there is no good general way in TS to allow it. Explicitly allowing every possible interfaces will be too exhaustive. |
Makes sense, thanks! |
ArrayBufferView may be the best option for those typed arrays. |
|
@iccir suggested in #408 that we should use Float32Array citing an older spec, but the latest one says it's
sequence<float>
.#409 also changed
VRLayer
and it also hassequence<float>
. (It's nowVRLayerInit
.)So I suggest that we revert #409, what do you think? @mhegazy
The text was updated successfully, but these errors were encountered: