There are many reasons for it which I’ll try to present in this post.
Typescript only adds a few extra features which are convenient for developers.
Probably the main reason to use typescript is this.
Having typechecks remove unneccesary errors. Types makes code more predictable.
Dynamically typed programming language have bad IDE support.
Everything is configurable.
Every typescript project has a “tsconfig.json” file which can be used to control everything typescript can do.
These include but are not limited to:
- Where to put the final output
- Ability to choose how strict the language is aka enable/disable following
- null checks
- any assignments
- Shortcut paths
Typescript compiles to JS
Typescript works fantastically with many libraries are framework.
Both major web libraries (React and Angular) support typescript.
How to transition from js to ts.
When you have a large application with lots of connected pieces, it makes sense to have connections between them standard.
So that as the application grows, the connections stay strong. And if parameters in a connection changes, it can be detected and changed at all places that use the connection.
Typescript does only a few things:
- Applies types and checks them
- Checks code quality to a level desired
- Compiles to JS version of your choice.