DEV Community

Discussion on: How do you deal with null vs undefined?

Collapse
 
johannesjo profile image
Johannes Millan

I consider casting without checks a strict no-no in strongly typed languages like TypeScript

That's an excellent point! Thank you very much! How do you usually deal with (unexpectedly) failing type checks in these scenarios? Do you just throw an error?

Collapse
 
wrldwzrd89 profile image
Eric Ahnell

Yep. I error (or skip if optional).