从鸿蒙api9升级到api11后把demo迁移过来后发现一个小问题 , 项目报了很多语法错误 , 应该是IDE更新后新增了语法约束检查
一: Property 'userName' has no initializer and is not definitely assigned in the constructor

微信图片_20240423160156.png
现在必须要给默认值了
二:Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)

1.png
约束变量需要显式声明类型

微信图片_20240423161026.png