1.出现报错的几种原因
(1)属性类型不对
(2)没有初始化
(3)undefined或null
2.解决的方法
(1)tsconfig.json中修改
"compilerOptions": {
"strictPropertyInitialization": false
}
(2)非空断言!:
(3)?:
(5)联合
value | undefined | null
1.出现报错的几种原因
(1)属性类型不对
(2)没有初始化
(3)undefined或null
2.解决的方法
(1)tsconfig.json中修改
"compilerOptions": {
"strictPropertyInitialization": false
}
(2)非空断言!:
(3)?:
(5)联合
value | undefined | null