配置 tsconfig.json

作用

指导编译器如何生成 JS 文件

参数

  • target: 编译目标平台(es3, es5, es2015)
  • module: 组织代码方式(commonjs, AMD)
  • sourceMap:编译文件对应关系
  • outDir:输出目录
  • exclude:不包含的编译目录
  • removeComments:编译生成的 JavaScript 文件是否移除注释
  • noImplicitAny:true/false;为 false 时,如果编译器无法根据变量的使用来判断类型时,将用 any 类型代替。为 true 时,进行强类型检查,会报错
  • tasks.json:指定编译的命令
{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}
posted @ 2017-08-08 00:52  Hao·z  阅读(7832)  评论(0编辑  收藏  举报