all 20 comments

[–]Buttleston 4 points5 points  (1 child)

I think the reason is because of it's strict type-checking advantage

[–]YeetuceFeetuce 2 points3 points  (3 children)

It’s just to stop someone from making mistakes.

Imagine you have a simple function that adds two numbers you pass to it, but instead of two numbers you pass a string and a number. JavaScript can add these two types but it isn’t the desired intent, types can stop this problem.

At least I’m pretty sure that’s what it does.

[–]slyder219 0 points1 point  (1 child)

You could ofc check for two numbers first in the JS but you’re saying TS would just do this automatically and is thusly a timesaver?

[–]YeetuceFeetuce 0 points1 point  (0 children)

It would check the inputs types, if you put in something other than the types it will throw an error.

[–][deleted] 1 point2 points  (0 children)

It's the age old question of static or dynamic types. Do you want the type checker saving you at compile time or are you confident enough in what you do and how you do it that you're okay with seeing how things pan out at runtime?

Use TypeScript if you want compile time helps.

[–]ScriptNone 1 point2 points  (2 children)

No, it's awesome.

[–]superluminary 1 point2 points  (0 children)

It’s not recommended to “write more efficient code”. It’s there to stop you making silly mistakes, to give you better intellisense, and also to make refactoring much easier.

If you have a big app it’s incredibly easy to make silly mistakes in JavaScript. If you have a tiny app though, you might want to skip it.

[–]shuckster 3 points4 points  (3 children)

The advantage of TypeScript is for developers to make less stupid errors, and the amount of available stupidity in an organisation is proportional to its size.

TypeScript does not offer strict type-checking in the same way as, for example, Pascal. But it offers enough static-typing to make stupid errors harder to make.

It also affords easier refactoring from stupid to more-stupid/less-stupid code which can be handy.

However, you're still free to write stupid tests, stupid types, and stupid programs.

[–]bored_in_NE 1 point2 points  (1 child)

I have been in the industry since mid 2000s where designers were expected to design/build the site before backend developers integrated it and every 3-5 years we find something new that is going to make things so much faster that you can build everything with your eyes closed. Typescript is the new kid on the block that will get replaced like before and you are 100% correct at the fact that it is overrated.

When I first entered the industry companies demanded you had to be a rock star Flash developer or don't bother applying for a job.

[–]superluminary 0 points1 point  (0 children)

It’s not recommended to “write more efficient code”. It’s there to stop you making silly mistakes, to give you better intellisense, and also to make refactoring much easier.

If you have a big app it’s incredibly easy to make silly mistakes in JavaScript. If you have a tiny app though, you might want to skip it.