- TypeScript is a superset of JavaScript. TypeScript code is compiled into JavaScript code. TypeScript = JavaScript + Additional Features.
- TypesScript files are saved with .ts. extension.
- Any valid .js file can be renamed to .ts.
- Compiled TypeScript can be consumed from any JavaScript code.
- It is pure Object Oriented Language like C# or Java with classes, objects, interfaces, inheritance etc.
- To learn TypeScript, you should have basic knowledge of JavaScript and Object Oriented concepts.
- TypeScript is portable across browsers, devices and operating systems. It can run on any environment where JavaScript can run.
- TypeScript provides with error-checking feature. It compiles the code and generate compilation error, if there are any syntax errors.
- TypeScript is strongly typed script. Variable declared with no type can be inferred by TLS (TypeScript Language Service) based on its value.
- TypeScript also supports type definition for existing JavaScript libraries. TypeScript Definition file, .d.ts extension, provides definition for external JavaScript libraries.
- When TypeScript is compiled, there is an option to create a declaration fie, which functions as an interface to the components in the compiled JavaScript.
- Declaration files are similar to header files in C++.
Components of TypeScript
- Language: It has syntax, keywords and type annotations.
- TypeScript Compiler: TypeScript Compiler (TSC) converts the TypeScript code into JavaScript.
- TypeScript Language Service: It exposes an additional layer around the core compiler pipeline that are editor-like applications.