# tsconfig 的解释说明
- 说明:所有的配置项都可以通过鼠标移入的方式,来查看配置项的解释说明。
- tsconfig 文档链接
{ | |
// 编译选项 | |
"compilerOptions": { | |
// 生成代码的语言版本 | |
"target": "es5", | |
// 指定要包含在编译中的 library | |
"lib": ["dom", "dom.iterable", "esnext"], | |
// 允许 ts 编译器编译 js 文件 | |
"allowJs": true, | |
// 跳过声明文件的类型检查 | |
"skipLibCheck": true, | |
//es 模块 互操作,屏蔽 ESModule 和 CommonJS 之间的差异 | |
"esModuleInterop": true, | |
// 允许通过 import x from 'y' 即使模块没有显式指定 default 导出 | |
"allowSyntheticDefaultImports": true, | |
// 开启严格模式 | |
"strict": true, | |
// 对文件名称强制区分大小写 | |
"forceConsistentCasingInFileNames": true, | |
// 为 switch 语句启用错误报告 | |
"noFallthroughCasesInSwitch": true, | |
// 生成代码的模块化标准 | |
"module": "esnext", | |
// 模块解析(查找)策略 | |
"moduleResolution": "node", | |
// 允许导入扩展名为.json 的模块 | |
"resolveJsonModule": true, | |
// 是否将没有 import/export 的文件视为旧(全局而非模块化)脚本文件。 | |
"isolatedModules": true, | |
// 编译时不生成任何文件(只进行类型检查) | |
"noEmit": true, | |
// 指定将 JSX 编译成什么形式 | |
"jsx": "react-jsx" | |
}, | |
// 指定允许 ts 处理的目录 | |
"include": ["src"] | |
} |
