Introduction to TypeScript

Introduction to TypeScript

  • TypeScript is a subset 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.

 

 

Unknown's avatar

Author: Akanksha Gupta

I am a developer and working on SharePoint and Project Server in an MNC. I have more than 10 years of experience in the same field.

Leave a comment

Design a site like this with WordPress.com
Get started