[Typescript] Definite assignment operator

The definite assignment !: operator is used to suppress TypeScript’s objections about a class field being used, when it can’t be proven1 that it was initialized.

Definite assignment operator can help with this case, if you are sure that the code will handle the assignement.

isSetup!: boolean

 

posted @ 2022-08-03 20:11  Zhentiw  阅读(18)  评论(0编辑  收藏  举报