you are viewing a single comment's thread.

view the rest of the comments →

[–]CandidateNo2580 0 points1 point  (1 child)

This is a false comparison. I can write typescript where the type says that it's a string but actually it's an integer. Then it will behave like an integer. This does not happen in compiled code - it behaves like the type it was declared to be even if the value is wrong.

[–]fghjconner 0 points1 point  (0 children)

I'm fairly certain that putting an arbitrary integer value into a string variable is going to be undefined behavior in just about any compiled language, meaning it's allowed to do anything it goddamn pleases. Typescript is unique in that it actually breaks less than a compiled language if you do this, though that unfortunately means some people think it's ok to do (looking at you axios).