2 Answers

0 votes
by

There are different reasons why a JavaScript developer should consider using TypeScript. Some of them include:

  1. Using new features of ECMAScript: TypeScript supports new ECMAScript standards and transpile them to ECMAScript targets of your choice. So, you can use features of ES2015 and beyond.
  2. Static Typing: JavaScript is dynamically typed and does not know what type a variable is until it is actually instantiated at run-time. TypeScript adds type support to JavaScript.
  3. Type Inference: TypeScript makes typing a bit easier and a lot less explicit by the usage of type inference. Even if you don’t explicitly type the types, they are still there to save you from doing something which otherwise would result in a run-time error.
  4. Better IDE Support: The development experience with TypeScript is a great improvement over JavaScript. There is a wide range of IDEs that have excellent support for TypeScript, like Visual Studio & VS code, Atom, Sublime, and IntelliJ/WebStorm.
  5. Strict Null Checking: Errors, like cannot read property ‘x’ of undefined, is common in JavaScript programming. You can avoid most of these kinds of errors since one cannot use a variable that is not known to the TypeScript compiler.
  6. Interoperability: TypeScript is closely related to JavaScript so it has great interoperability capabilities, but some extra work is required to work with JavaScript libraries in TypeScript.

0 votes
by

We need TypeScript:

  • TypeScript is fast, simple, and most importantly, easy to learn.
  • TypeScript supports object-oriented programming features such as classes, interfaces, inheritance, generics, etc.
  • TypeScript provides the error-checking feature at compilation time. It will compile the code, and if any error found, then it highlighted the errors before the script is run.
  • TypeScript supports all JavaScript libraries because it is the superset of JavaScript.
  • TypeScript support reusability by using the inheritance.
  • TypeScript make app development quick and easy as possible, and the tooling support of TypeScript gives us autocompletion, type checking, and source documentation.
  • TypeScript supports the latest JavaScript features including ECMAScript 2015.
  • TypeScript gives all the benefits of ES6 plus more productivity.
  • TypeScript supports Static typing, Strongly type, Modules, Optional Parameters, etc.
...