羊仔
羊仔
  • 发布:2019-07-09 09:25
  • 更新:2019-07-09 10:21
  • 阅读:1152

typescript 下,小程序的一些原生方法报错,怎么解决

分类:uni-app

源码为:
uni.getSetting({
success: (res:any)=>{}
})

报错为:
Argument of type '{ success: (res: any) => void; }' is not assignable to parameter of type 'GetSettingOptions'.
Types of property 'success' are incompatible.
Type '(res: any) => void' is not assignable to type '() => void'.

2019-07-09 09:25 负责人:无 分享
已邀请:
羊仔

羊仔 (作者)

let result:any;
result = await uni.getSetting();
if(result[1].authSetting['scope.userInfo']){
this.getUserInfo();
}

这样可以 不过总觉得有点取巧

该问题目前已经被锁定, 无法添加新回复