849
you are viewing a single comment's thread
view the rest of the comments
[-] andreax@lemm.ee 5 points 1 year ago

No, it is slower than JS but it can be compiled to JS. The point of typescript is bringing static (or generally talking, predictable) types to variables, so that treating erroneously a number as a string should be more difficult. In a large codebase, it's easy to make mistakes and debugging is not instantaneous but it needs time. Typescript helps here. You write more code but it helps you out later

[-] mea_rah@lemmy.world 2 points 1 year ago

I don't have much experience with TS, but in other strongly typed language it goes even further than string vs number.

For example you can have two numbers Distance and TimeInSeconds and even though they are both numbers, the type system can make sure that you won't do distance+time.

It can also let you do distance/time and return Speed type.

It will prevent many logical errors even though everything is technically a number.

this post was submitted on 14 Nov 2023
849 points (100.0% liked)

Programmer Humor

35490 readers
30 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS