DEV Community

Discussion on: How to Start Using Typescript

Collapse
 
karfau profile image
Christian Bewernitz

I would say that ! is as dangerous as as Xyz.

Basically you are saying: "I know what I'm doing, leave me alone."

But typescript only ever checks at compile time, never at runtime, so when you get back something else, a lot of assumptions in your code will go away.

It's better to check for undefined/null values if typescript tells you.

Which is also very convinient by using the operators introduced for that, like ?., ?? etc.