HarmonyOS_Next 星河版迁移报错记录【自用】
Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)
对象字面量必须对应于一些显式声明的类或接口(arkts-no-untyped-obj-literals)
// ❌
const opt = {
size: { height: 3, width: 5 },
pixelFormat: 3,
editable: true,
alphaType: 1,
scaleMode: 1
};
Use explicit types instead of "any", "unknown" (arkts-no-any-unknown)
使用显式类型代替"any", "unknown" (arkts-no-any-unknown)
Property 'title' has no initializer and is not definitely assigned in the constructor.
属性'title'没有初始化器,也没有在构造函数中明确赋值。< ArkTSCheck >
@Component
export struct TitleDividerComp {
title: string // ❌
title: string = '' // ✅
fontSize?: number = 14
build() {
Row() {
Text(this.title)
.fontSize(this.fontSize)
.fontWeight(500)
.fontColor($r('app.color.font_sub'))
}
.width('100%')
.height(40)
.backgroundColor($r('app.color.background'))
.padding({ left: 20, right: 20 })
}
}
You are advised to initialize the width and height attributes of the List component.
建议初始化List组件的width和height属性。< ArkTSCheck >
Declaration merging is not supported (arkts-no-decl-merging)
不支持声明合并(arkts-no- declare - merge)
interface Item {
id: string
name: string
tel: string
}
Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)
泛型函数调用的类型推断是有限的(arkts-no- infer- generic-params)
list: string[] = Array.from({ length: 5 }, () => Math.random()
.toString()
.slice(2, 2+4))
list: string[] = Array(5).fill(Math.random().toString().slice(2, 2 + 4))
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 我与微信审核的“相爱相杀”看个人小程序副业
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· spring官宣接入deepseek,真的太香了~