您的当前位置:首页正文

HarmonyOS NEXT创建对象提示Object literal must correspond to some explicitly declared class or interface

2024-11-08 来源:个人技术集锦

HarmonyOS NEXT创建对象提示Object literal must correspond to some explicitly declared class or interface

let userinfo={
  username:"张三",
  age:20,
  sex:"男"
}

解决办法:

interface UserInfoInterface{
  username:string,
  age:number,
  sex:string
}

let userinfo:UserInfoInterface={
  username:"张三",
  age:20,
  sex:"男"
}

显示全文