Some WebAudio signatures use number[] instead of Float32Array #23160
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
Milestone
TypeScript Version: 2.8.1
Search Terms: WebAudio, setValueCurveAtTime
Code
Expected behavior:
GainNode's first parameter should be a
Float32Array
per the WebAudio specification. TypeScript'slib.d.ts
file thinks it's anumber[]
. The above code shouldn't warn.Actual behavior:
Argument of type 'Float32Array' is not assignable to parameter of type 'number[]'
Playground Link: http://www.typescriptlang.org/play/#src=%2F%2F%20WebAudio%20setValueCurveAtTime%20issue%0D%0A%0D%0Alet%20context%3A%20AudioContext%3B%0D%0A%0D%0Afunction%20demo(conext%3A%20AudioContext)%20%7B%0D%0A%20%20%20%20let%20gainNode%20%3D%20context.createGain()%3B%0D%0A%20%20%20%20let%20sampleCount%20%3D%20Math.floor(0.25%20*%20context.sampleRate)%3B%0D%0A%0D%0A%20%20%20%20let%20values%20%3D%20new%20Float32Array(100)%3B%0D%0A%20%20%20%20for%20(let%20i%20%3D%200%3B%20i%20%3C%20sampleCount%3B%20i%2B%2B)%20%7B%0D%0A%20%20%20%20%20%20%20%20values%5Bi%5D%20%3D%20i%20%2F%20sampleCount%3B%0D%0A%20%20%20%20%7D%0D%0A%0D%0A%20%20%20%20gainNode.gain.setValueCurveAtTime(values%2C%200%2C%20sampleCount%20%2F%20context.sampleRate)%3B%0D%0A%7D%0D%0A
Related Issues:
The text was updated successfully, but these errors were encountered: