DEV Community

Discussion on: JavaScript can do that?

Collapse
 
cubiclebuddha profile image
Cubicle Buddha

This is one of the many great reasons to use TypeScript. It's not that TypeScript won't let you do these strange things... it's just that it's like "did you know that you're about to automatically coerce your number to a string?"

Collapse
 
nssimeonov profile image
Templar++

No amount of TypeScript can save you from JS quirks, but at least Saint A. Hejlsberg did a good job helping as much as he could...

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I'm not sure typescript will save you from JavaScript itself maybe 50% of the above insanity.

Collapse
 
tarascz profile image
Jiří Tarašovič

The rest of 50% you can avoid by using '===' instead of '==' as it's recommended everywhere.

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

I always assumed everyone knew that 😆. It's been a while since I started.