tsconfig.json 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {
  2. //编译ts文件命令:tsc
  3. // 监听编译 tsc -w
  4. // 匹配入口文件
  5. // ./ 同级 ../上级
  6. // * 任意文件
  7. // ** 任意文件目录
  8. "include": [
  9. "./src/**/*"
  10. ],
  11. // 匹配出口(排除)文件
  12. // "exclude": [
  13. // "./src/**/*"
  14. // ]
  15. // extends 继承
  16. // "files":[ 文件
  17. // "./src/b.ts",
  18. // "./xxx"
  19. // ]
  20. // 编译选项
  21. "compilerOptions": {
  22. // 解决target自带的版本报错
  23. "moduleResolution": "Node",
  24. // 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'es2024', 'esnext'.
  25. // 规定ts转成什么版本的js
  26. "target": "ES6",
  27. // 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve
  28. "module": "amd",
  29. // 规定可以使用哪些库
  30. "lib": ["dom"],
  31. // 规定编译后的文件位置
  32. "outDir": "./dist",
  33. // 将编译后的文件全部放在一个文件夹内
  34. "outFile": "./dist/hello.js",
  35. // 允许编译js文件
  36. "allowJs": true,
  37. // 检查js代码是否符合规范
  38. "checkJs": true,
  39. // 移除注释
  40. "removeComments": true,
  41. // 严格模式
  42. // "strict": false
  43. // 规定错误是否允许被编译
  44. // "noEmitOnError": true,
  45. // 规定文件是否允许被编译
  46. // "noEmit":false,
  47. // "alwaysStrict": true,
  48. // 规定不允许使用any
  49. "noImplicitAny": true,
  50. // 规定不允许使用this
  51. // "noImplicitThis": true,
  52. // 检查元素是否为空
  53. // "strictNullChecks": true
  54. }
  55. }