Typescript

  • TypeScript is a strongly typed, object oriented, compiled language.
  • It was designed by Microsoft.
  • TypeScript is both a language and a set of tools.
  • TypeScript is JavaScript plus some additional features.

image

  • JavaScript is TypeScript. This means that any valid .js file can be renamed to .ts and compiled with other TypeScript files.
  • TypeScript supports Object Oriented Programming concepts like classes, interfaces, inheritance, etc.

Difference between ES6 (ES2015) and Typescript

There is no difference in both of them. Everything you write in ES6 is supported by Typescript. Typescript is an extension of ES6. So whatever is valid JavaScript will be valid TypeScript so no other changes are needed. Some features that are additionally included in Typescript are:

  • Type Annotations
    • eg:
      • name: string = 'SURESH'
      • age: number = '123';
  • Interfaces
  • Enums
  • Mixins

and many more…

Typescript - Types

Data type Keyword
Number number
String string
Boolean boolean
Void void
Null null
Undefined undefined