Skip to content

Commit

Permalink
fix(types): align WebAudioContext.decodeAudioData signature with weap…
Browse files Browse the repository at this point in the history
…p docs (#17081)

Updated the `decodeAudioData` method in `WebAudioContext` to match the official WeChat Mini Program documentation:
- Modified the return type to `Promise<AudioBuffer>` instead of `AudioBuffer`, because of this method' actual response.
- Adjusted method parameters to accept `audioData`, `successCallback`, and `errorCallback`.

This fixes the TypeScript error and aligns the implementation with the expected API behavior.
Closes #17080

Co-authored-by: Shijie Yu <[email protected]>
  • Loading branch information
BH4HPA and tutuxxx authored Jan 6, 2025
1 parent 9477f02 commit 6964768
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/taro/types/api/media/audio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,11 @@ declare module '../../index' {
* ```
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html
*/
decodeAudioData(): AudioBuffer
decodeAudioData(
audioData: ArrayBuffer,
successCallback: (buffer: AudioBuffer) => void,
errorCallback: (error: any) => void
): Promise<AudioBuffer>
}

namespace WebAudioContext {
Expand Down

0 comments on commit 6964768

Please sign in to comment.