/** * 补充 @douyin-microapp/typings 中缺失的抖音小程序 API 类型声明 * 这些 API 在运行时是可用的,但在 @douyin-microapp/typings@1.3.1 中未被声明 * * 如需补充更多缺失的 API,直接在下方 TtExtensions 接口中添加即可,全项目生效。 */ interface ShareAppMessageOptions { title?: string; imageUrl?: string; query?: string; channel?: string; desc?: string; extra?: Record; templateId?: string; } interface RequestGamePaymentOptions { mode: string; env: number; platform?: string; currencyType: string; buyQuantity?: number; zoneId?: string; customId?: string; goodType?: number; orderAmount?: number; goodName?: string; extraInfo?: string; success?: (res: any) => void; fail?: (error: any) => void; complete?: (res: any) => void; } interface OpenAwemeCustomerServiceOptions { zoneId?: string; customId?: string; currencyType?: string; buyQuantity?: number; goodType?: number; orderAmount?: number; goodName?: string; extraInfo?: string; success?: (res: any) => void; fail?: (error: any) => void; complete?: (res: any) => void; } interface TtExtensions { /** 主动拉起转发,进入选择通讯录界面 */ shareAppMessage: (options: ShareAppMessageOptions) => void; /** 监听用户点击右上角菜单中的「转发」按钮时触发的事件 */ onShareAppMessage: ( callback: (options?: { from?: string; target?: any; webViewUrl?: string; }) => ShareAppMessageOptions ) => void; /** 取消监听用户点击右上角菜单中的「转发」按钮时触发的事件 */ offShareAppMessage: (callback?: (...args: any[]) => void) => void; /** 安卓虚拟支付 */ requestGamePayment: (options: RequestGamePaymentOptions) => void; /** iOS 拉起抖音客服支付 */ openAwemeCustomerService: (options: OpenAwemeCustomerServiceOptions) => void; } declare global { const tt: typeof import("@douyin-microapp/typings/types/api") & TtExtensions; } export {};