TypeScript exclamation mark operator

 The ! operator tells the compiler not to complain about not checking if a value is null. 

It is very useful when you know for sure that an item is initialized after the declaration.

par: number | undefined.

myfunc(a: number) {

}

...

this.myfunc(this.par!);

Post a Comment

Previous Post Next Post