项目配置 tsconfig.json

  1. {
  2. "compilerOptions": {
  3. "module": "commonjs",
  4. "noImplicitAny": true,
  5. "removeComments": true,
  6. "preserveConstEnums": true,
  7. "sourceMap": true
  8. },
  9. "files": [
  10. "core.ts",
  11. "sys.ts",
  12. "types.ts",
  13. "scanner.ts",
  14. "parser.ts",
  15. "utilities.ts",
  16. "binder.ts",
  17. "checker.ts",
  18. "emitter.ts",
  19. "program.ts",
  20. "commandLineParser.ts",
  21. "tsc.ts",
  22. "diagnosticInformationMap.generated.ts"
  23. ]
  24. }
选项 类型 | 默认值 描述
allowJs boolean | false 允许编译javascript文件
checkJs boolean | false 在.js文件中报告错误。与allowJs配合使用
allSyntheticDefaultImports
允许从没有设置默认导出的模块中默认导出,仅为了类型检查
allowUnreachableCode boolean | 默认false 不报告执行不到的代码错误
allowUnusedLabels boolean | false 不报告未使用的标签错误
charset string | utf8 输入文件的字符集
declaration boolean | false 生成对应的 .d.ts文件
diagnostics boolean | flse 显示诊断信息
disableSizeLimit boolean | false 禁用javascript工程体积大小的限制
emitBOM boolean | false 在输出文件的开头加入BOM头
forceConsistentCasingInfileNames boolean | false 禁止对一个文件不一样的引用
init 初始化typescript项目并创建一个tsconfig.json文件
isolatedModules boolean | false 将每个文件作为单独的模块
jsx string | Preserve 在.tsx文件里支持JSX:React 或 Preserve
lib string | DOM,ES5,ScriptHost | DOM,ES6,DOM.Iterable,ScriptHost 编译过程中需要引入的库文件列表
可能值:ES5 | ES6 | DOM | WebWorker | ES2015.Core …
listFiles string 编译过程中打印文件名
mapRoot
outDir string 重定向输出目录
version 打印编译器版本号