一、安装依赖

  1. cnpm i typescript -g 安装ts
  2. cnpm i ts-node -g 安装ts
  3. tsc --version 查看ts的版本号

编译

  1. // 在ts中 变量后面: 指明变量的类型
  2. var str:string = "hello world"
  3. console.log(str);
  1. 编译
  2. tsc 01hello.ts

安装插件

  1. Code Runner

运行

  1. 1-1 tsc --init tsconfig.json
  2. 1-2 终端-->运行任务--> tsc:监视 tsconfig.json