TypeScript course

TypeScript yes JavaScript A superset of , support ECMAScript 6 Standard (ES6 course ).

TypeScript Free and open source programming language developed by Microsoft .

TypeScript The design goal is to develop large-scale applications , It can be compiled into pure JavaScript, Compiled JavaScript Can run on any browser .


Language characteristics

TypeScript It's a way to JavaScript Add language extensions for features . Additional features include :

  • Type annotation and compile time type checking
  • Type inference
  • Type erase
  • Interface
  • enumeration
  • Mixin
  • Generic programming
  • Namespace
  • Tuples
  • Await

The following functions are from ECMA 2015 From reverse transplantation :

  • class
  • modular
  • lambda The arrow syntax of the function
  • Optional parameters and default parameters

JavaScript And TypeScript The difference between

TypeScript yes JavaScript Superset of , Extended JavaScript Grammar of , So the existing JavaScript The code can be used with TypeScript Work together without any modification ,TypeScript Provide static type checking at compile time through type annotations .

TypeScript Can handle existing JavaScript code , And only for TypeScript Compile the code .


first TypeScript example

In the following example, we use TypeScript To output Hello World!:

example

const hello : string = " Hello World! " console . log ( hello )

Give it a try »