What is TypeScript?
- TypeScript is an open-source pure object-oriented programing language.
- TypeScript is developed and maintained by Microsoft under Apache 2 license.
- TypeScript was developed by Anders Hejlsberg, who is also one of the core members of the development team of C# language.
- TypeScript was first released in the month of 1st October 2012 and was labeled version 0.8.
- TypeScript is a language as well as a set of tools.
- TypeScript can be executed on Any browser, Any Host, and Any Operating System.
- TypeScript source file is in ".ts" extension. We can use any valid ".js" file by renaming it to ".ts" file.
||Protected modifier, tuple types
||union types, let and const declarations, type guards, type aliases, template strings
||ES6 modules, decorators, for..of support, namespace keyword
||JSX support, abstract classes and methods, local type declarations, intersection types, user-defined type guard functions
||async and await support
||constraints generic, control flow analysis errors, string literal types, allowJs
||control flow based type analysis, null-and undefined-aware types, never type, discriminated union types, readonly keyword, type of this for functions
||mapped types, keyof and lookup types, object spread and rest
||object type, mix-in classes
||async iteration, strict option, generic parameter defaults
||dynamic import expressions, improved inference for generics, string enums, strict contravariance, for callback parameters
||optional catch clause variables
||strict function types
||fixed length tuples, constant-named properties
||improved keyof with intersection types, conditional types
||support for symbols and numeric literals in keyof and mapped object types
||project references, extracting and spreading parameter lists with tuples
||mappable tuple and array types
||stricter checking for bind, call, apply
Why use TypeScript?
- TypeScript supports Static typing, Strongly type, Modules, Optional Parameters, etc.
- TypeScript supports object-oriented programming features such as classes, interfaces, inheritance, generics, etc.
- TypeScript is fast, simple, and most importantly, easy to learn.
- 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 support reusability because of 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 gives all the benefits of ES6 plus more productivity.