DEV Community

Discussion on: TypeScript is more than you think

Collapse
 
damxipo profile image
Damian Cipolat

Several days ago I have been reading about typescript and I still can't find the advantage to use it, I was looking for that maybe it could be a great tool for handling numbers but funny there is no implementation of float, double etc. only "number" maybe you could guide me if there was something in typescript to handle numbers more precisely. for example differences of decimal places of integers, of positives of negatives etc.

Collapse
 
macsikora profile image
Pragmatic Maciej

The question is advantage over what? You need to consider that TypeScript is very pragmatic language in terms of its connection with JavaScript. The data level is not touched, it means that TS has the same primitive types as JS has, but TS makes them explicit.

TypeScript is JavaScript with additional compile time processing of the code. The article focus at this additional type level which is added.

In terms of numbers, JS has primitive number type, TS follows that to be fully compatible. If you want to have language which solves JS issues in numbers you need to take a look at languages which are not compatible with JS. And there are few - Elm, ReasonML, PureScript. There you don't have JS issues.

So TS is natural choice for JS devs, as you know most of the language day one. Its much harder to migrate the whole team to some fully functional language, therefor TS remains a sweet spot of productivity and reliability.