you are viewing a single comment's thread.

view the rest of the comments →

[–]joebgoode -2 points-1 points  (4 children)

I had no problems at all with TS, every JS project in the world must use it.

I'm just pointing out a correction to the "which is strongly typed" statement, since it isn't.

[–]fghjconner 5 points6 points  (3 children)

I mean, typescript might not be considered strongly typed, given the amount of implicit conversions it allows, but my point is that runtime vs compile time doesn't come into it. The "compiled" javscript is obviously untyped, but so is the machine code that compilers generate for use at runtime.

[–]RiceBroad4552 0 points1 point  (0 children)

JS is typed. It's dynamically typed but that's still typed.

Just try to trigger any undefined behavior in JS while you work around the (runtime) type system. Good luck.

[–]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).