一:基础静态类型

    1. const age: number = 18
    2. const name: string = 'james'

    二:对象类型

    1. 对象类型

      1. let nbaHero: {
      2. name: string,
      3. age: number
      4. } = {
      5. name : 'james',
      6. age: 18
      7. }
    2. 数组类型

      1. let nbaHero: String[] = ['james', 'curry', 'westbrook']
    3. 类类型

      1. class Hero{}
      2. let nbaHero: Hero = new Hero()
    4. 函数类型

      1. const nba: () => string = () => {
      2. return 'james'
      3. }

    三:自定义静态类型

    1. interface
      1. interface Person{
      2. name: string,
      3. age: number
      4. }
      5. let a: Person = {
      6. name: 'a',
      7. age: 18
      8. }