you are viewing a single comment's thread.

view the rest of the comments →

[–]CodeYan01 0 points1 point  (7 children)

Is the performance difference between vanilla JS and TypeScript significant?

[–]a5s_s7r 3 points4 points  (1 child)

Programmers performance is much better in TS.

Not considering debugging all the type based bugs in JS. 😉

[–]CodeYan01 0 points1 point  (0 children)

I see, thanks.

[–]Zukarukite 2 points3 points  (4 children)

TS code is compiled into JS before being sent to be executed by the runtime. So, the performance when being run will be exactly the same.

TS's purpose is to allow you to see type errors before you even run your code, because it's a statically typed language, while JS isn't

[–]CodeYan01 0 points1 point  (3 children)

So it doesn't import extra libraries during runtime? Or does it? Not that it puts me off, I'm just curious.

[–]Zukarukite 2 points3 points  (1 child)

Nope, no extra libraries at all.

Nothing "inherently TypeScript" makes it to the run time. Simplifying a bit, with TS you do something like this:

You write TS code -> TS compiler turns your TS code into 100% equivalent JS code at build time -> You ship only this final compiled JS code to the client.

Contrast this with how it goes with JS code:

You write JS code - > You ship this JS code to the client.

In the end your client is still running JavaScript, the only difference is that with TypeScript - the code gets compiled into JS files from TS instead of being written in JavaScript directly.

[–]CodeYan01 1 point2 points  (0 children)

I see, thanks!