Left JS to code TS, here are 10 cool things about Typescript
I am a Javascript fanboy. With a change in work assignment, I started with Typescript, and it's great. There were quite some aha moments, and I am hooked. I would still keep up with Javascript but code in Typescript irrespective of the framework.
What is Typescript?
Typescript is a superset of Javascript. It means, it has the goodness of Javascript along with a few more features.
Tell about Aha moments
-
Typescript is easy to learn when you learn from the context of the framework/library. In my case, I was able to learn the basic typescript needed to work with React.
-
Typescript is gentle. It gets mad only when it's not able to infer the data type of the variable
-
Typescript is easy to read compared to JS. No more guess games and loading with hacks.
-
Tooling is mostly done by the CLIs and tweaking it is easy
-
Easy for teams and external stakeholders working with the same code or consuming the library. Thanks to type definitions associated with props.
-
We can focus on business logic. Let the TS take care of preventing typecasting and other nasty issues.
-
Typescript is not a cry baby complaining about type mismatches. It's smart and mostly figures out a lot of things.
-
Functions are easy to understand and consume. We know the number of arguments and their data types clearly
-
The syntax of Typescript is not evil, it's making IDE smarter. Typescript increases productivity.
-
We can use JS inside TS easily and get our work done. TS gets compiled to JS so the browsers do not get upset with TS.