12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- {
- //编译ts文件命令:tsc
- // 监听编译 tsc -w
- // 匹配入口文件
- // ./ 同级 ../上级
- // * 任意文件
- // ** 任意文件目录
- "include": [
- "./src/**/*"
- ],
- // 匹配出口(排除)文件
- // "exclude": [
- // "./src/**/*"
- // ]
- // extends 继承
- // "files":[ 文件
- // "./src/b.ts",
- // "./xxx"
- // ]
- // 编译选项
- "compilerOptions": {
- // 解决target自带的版本报错
- "moduleResolution": "Node",
- // 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'es2024', 'esnext'.
- // 规定ts转成什么版本的js
- "target": "ES6",
- // 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve
- "module": "amd",
- // 规定可以使用哪些库
- "lib": ["dom"],
- // 规定编译后的文件位置
- "outDir": "./dist",
- // 将编译后的文件全部放在一个文件夹内
- "outFile": "./dist/hello.js",
- // 允许编译js文件
- "allowJs": true,
- // 检查js代码是否符合规范
- "checkJs": true,
- // 移除注释
- "removeComments": true,
- // 严格模式
- // "strict": false
- // 规定错误是否允许被编译
- // "noEmitOnError": true,
- // 规定文件是否允许被编译
- // "noEmit":false,
- // "alwaysStrict": true,
- // 规定不允许使用any
- "noImplicitAny": true,
- // 规定不允许使用this
- // "noImplicitThis": true,
- // 检查元素是否为空
- // "strictNullChecks": true
- }
- }
|