HarmonyOS 鸿蒙Next:Object literal must correspond to some explicitly declared class or interface
HarmonyOS 鸿蒙Next:Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)
求帮助,我应该如何修改代码呢?
export interface SetTitleParamBean {
hidden: boolean
image: string
text: string
}
export interface WebViewControllerCallback {
getController(): webview.WebviewController
setTitle(params: SetTitleParamBean): void
}
controller: webview.WebviewController = new webview.WebviewController();
private callback: WebViewControllerCallback = { //这里报错了
getController: (): webview.WebviewController => {
return this.controller;
},
setTitle: (params: SetTitleParamBean): void => {
}
}
报错为Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)
请问各位大佬如何修改这个问题呢?
HarmonyOS Next(纯血鸿蒙)实战教程免费学: https://www.itying.com/goods-1204.html
更多关于HarmonyOS 鸿蒙Next:Object literal must correspond to some explicitly declared class or interface的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
关于你的Object literal must correspond to some explicitly declared class or interface
这个问题是在HarmonyOS Next 中出现的
HarmonyOS Next 纯血鸿蒙的课程已发布 :https://www.itying.com/category-93-b0.html
可以先学学上面的免费课程,也可以参考下面的解决方法
字面量的写法如下
let param:object = {
'key1':value1,
'key2': value2
}
上面代码报错: Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)
修改后:
let param:object = Object({
'key1':value1,
'key2': value2
})
更多关于HarmonyOS 鸿蒙Next:Object literal must correspond to some explicitly declared class or interface的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
找HarmonyOS工作还需要会Flutter的哦,有需要Flutter教程的可以学学大地老师的教程,很不错,B站免费学的哦:https://www.bilibili.com/video/BV1S4411E7LY/?p=17