Skip to content
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

wx.onNeedPrivacyAuthorization方法的参数类型错误 #309

Open
taodaran opened this issue Sep 8, 2023 · 5 comments
Open

wx.onNeedPrivacyAuthorization方法的参数类型错误 #309

taodaran opened this issue Sep 8, 2023 · 5 comments

Comments

@taodaran
Copy link

taodaran commented Sep 8, 2023

正确的类型应该是一个resolve和一个info,然而实际上是{errMsg:string}

@xucr11
Copy link

xucr11 commented Sep 8, 2023

正确的类型应该是一个resolve和一个info,然而实际上是{errMsg:string}

你再看仔细点?

@wsli10
Copy link

wsli10 commented Sep 11, 2023

正确的类型应该是一个resolve和一个info,然而实际上是{errMsg:string}

你再看仔细点?

@xucr11

https://github.com/wechat-miniprogram/api-typings/blob/master/types/wx/lib.wx.api.d.ts#L25493-L25496

onNeedPrivacyAuthorization(
    /** 隐私接口需要用户授权事件的监听函数 */
    listener: OnNeedPrivacyAuthorizationCallback
): void

https://github.com/wechat-miniprogram/api-typings/blob/master/types/wx/lib.wx.api.d.ts#L30422-L30424

type OnNeedPrivacyAuthorizationCallback = (
    res: GeneralCallbackResult
) => void

https://github.com/wechat-miniprogram/api-typings/blob/master/types/wx/lib.wx.api.d.ts#L4965C2-L4968C6

interface GeneralCallbackResult {
    /** 错误信息 */
    errMsg: string
}

image

@JourneyL
Copy link

JourneyL commented Dec 1, 2023

@wsli10 有临时解决方案吗

@wsli10
Copy link

wsli10 commented Dec 1, 2023

@wsli10 有临时解决方案吗

@JourneyL 现在隐私弹窗不写也行,微信会有官方的弹窗😓

如果需要自定义弹窗,还必须用TS,那就直接 as unknown as XXX

type Resolve = (resolveOptions: {
  event: 'agree' | 'disagree' | 'exposureAuthorization';
  buttonId?: string;
}) => void

wx.onNeedPrivacyAuthorization(resolve => {
  (resolve as unknown as Resolve)(...)
})

@JourneyL
Copy link

JourneyL commented Dec 4, 2023

@wsli10 好的谢谢大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants