{
// 编译器选项
"compilerOptions": {
// 生成代码的语言版本:将我们写的 TS 代码编译成哪个版本的 JS 代码
"target": "es5",
// 指定要包含在编译中的 library
// https://github.com/microsoft/TypeScript/blob/90e83adb44/lib/lib.dom.iterable.d.ts
// esnext 寻找下个es最新的版本
"lib": ["dom", "dom.iterable", "esnext"],
// 允许 ts 编译器编译 js 文件
"allowJs": true,
// 对js文件也进行类型检测
"checkJs": true
// 跳过类型声明文件的类型检查s
"skipLibCheck": true,
// es 模块 互操作,屏蔽 ESModule 和 CommonJS 之间的差异
"esModuleInterop": true,
// 允许通过 import x from 'y' 即使模块没有显式指定 default 导出
"allowSyntheticDefaultImports": true,
// 生成.d.ts 声明文件
"declaration": true
// 开启严格模式
"strict": true,
// 对ts声明文件是否跳过类型检查
"skipLibCheck": true
// 搜索第三包必须借助 声明文件
"typeRoots": ["node_modules/@types"],
// 对文件名称强制区分大小写
"forceConsistentCasingInFileNames": true,
// 为 switch 语句启用错误报告
"noFallthroughCasesInSwitch": true,
// 生成代码的模块化标准 esnext CommonJs
"module": "esnext",
// 模块解析(查找)策略 typescript 编译器用何种方式来确定导入所指内容
// 1. 采用node是 从内到外方式查找文件 查找import 引入的文件
// 2. 采用classic 从外层到内层方式查找 查找import 引入的文件
"moduleResolution": "node",
// 允许导入扩展名为.json的模块
"resolveJsonModule": true,
// 是否将没有 import/export 的文件视为旧(全局而非模块化)脚本文件
"isolatedModules": true,
// 编译时不生成任何JS文件(只进行类型检查)
"noEmit": true,
// 将 JSX 编译成什么形式
"jsx": "react-jsx",
// 编译的文件目录
"rootDir": "./src",
// 编译之后的文件目录
"outDir": "./dist",
// 所有node第三方包都被支持
"types": ["node"],
// .表示项目根路径
"baseUrl": "./",
// 配置路径别名
"paths": {
"@/src/*": ["all/src/*"]
},
// 指定允许 ts 处理的目录
"include": ["src"]
"exclude": [],
// 继承
"extends": ""
}