http://www.typescriptlang.org/docs/index.html

angular 2 - 003 typescript

var book: string = "hellp angular 2";
var num: number = 123;

function lg (msg :string): void{
  console.log(msg)
}

类和接口

interface Shape{
  area(): number;
}

class Rectangle implements Shape{
  constructor(
      private width: number.
       private length: number
  ){}

//实现方法
  area(){
    return this.width  * this.length;
  }
}

装饰器


angular 2 - 003 typescript

相关文章: