From 182420e56041b1578cec077182c486bcf3e81ca3 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 25 Dec 2024 21:04:40 +0800 Subject: [PATCH] fix(types): align WebAudioContext.decodeAudioData signature with weapp docs Updated the `decodeAudioData` method in `WebAudioContext` to match the official WeChat Mini Program documentation: - Modified the return type to `Promise` 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 --- packages/taro/types/api/media/audio.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/taro/types/api/media/audio.d.ts b/packages/taro/types/api/media/audio.d.ts index 0d8eedcac9f0..3a938cc0d168 100644 --- a/packages/taro/types/api/media/audio.d.ts +++ b/packages/taro/types/api/media/audio.d.ts @@ -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 } namespace WebAudioContext {