TypeScript is a superset of JavaScript that adds static types to JavaScript.
Enforcing static typing.
An editor that supports TypeScript like vscode can deliver “quick fixes” to automatically fix errors, refactorings to easily re-organize code, and useful navigation features for jumping to definitions of a variable or finding all references to a given variable. All of this is built on top of the type-checker and is fully cross-platform.
Prevents runtime errors by blocking any attempt to access properties that do not exist on an object and return undefined.
Improved code readability as anyone can understand what type of data is expected in a variable, parameter or value returned by a function
Error-free code refactoring as any breaking change in function definition will be highlighted.
Encapsulation and abstraction of the details of different object instances by using types, interfaces and classes.
Promotes modular code using ES6 or commonJS module system to prevent global scope pollution and naming conflicts.
Better collaboration among developers working on different interacting parts of the same codebase as it establishes clear contracts for data to be used.