?
: 属性或参数中使用 ?:表示该属性或参数为可选项
interface Test {
firstName?: string,
lastName: string,
}
function people(p: Test){
console.log(`${p.firstName ? p.firstName : '野原' + p.lastName }`)
}
people({lastName:'新之助'}) //原新之助
!
:变量后使用 !:表示类型推断排除null、undefined!!
: https://blog.youkuaiyun.com/m0_37604745/article/details/78470669