顶层配置
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| files | false | 待编译文件列表 |
| extends | false | 继承配置文件 |
| include | false | 待编译文件 glob 模式列表 |
| exclude | false | 排除文件 glob 模式列表 |
| references | false | 引用配置文件列表 |
类型检查
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| allowUnreachableCode | undefined | 允许代码块内未使用的代码 |
| allowUnusedLabels | undefined | 允许未使用的标签 |
| alwaysStrict | undefined | 启用严格模式 |
| exactOptionalPropertyTypes | undefined | 启用精确可选属性类型 |
| noFallthroughCasesInSwitch | undefined | 禁止 switch 语句 fallthrough |
| noImplicitAny | true | 禁止隐式 any 类型 |
| noImplicitOverride | undefined | 禁止使用 override 修饰符 |
| noImplicitReturns | undefined | 禁止隐式返回类型 |
| noImplicitThis | true | 禁止隐式 this 类型 |
| noPropertyAccessFromIndexSignature | undefined | 禁止通过索引签名访问属性 |
| noUncheckedIndexedAccess | undefined | 禁止使用未检查的索引访问 |
| noUnusedLocals | undefined | 禁止未使用的局部变量 |
| noUnusedParameters | undefined | 禁止未使用的参数 |
| strict | undefined | 启用严格模式 |
| strictBindCallApply | true | 启用严格绑定调用和应用 |
| strictBuiltinIteratorReturn | false | 启用严格内置迭代器返回 |
| strictFunctionTypes | true | 启用严格函数类型 |
| strictNullChecks | true | 启用严格空检查 |
| strictPropertyInitialization | true | 启用严格属性初始化 |
| useUnknownInCatchVariables | true | 启用未知类型在 catch 块中变量 |
模块
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| allowArbitraryExtensions | true | 允许使用任意扩展名 |
| allowImportingTsExtensions | undefined | 允许导入 .ts 文件 |
| allowUmdGlobalAccess | undefined | 允许访问 UMD 全局变量 |
| baseUrl | undefined | 模块解析的根目录 |
| customConditions | undefined | 自定义条件 |
| module | CommonJS | 模块类型 |
| moduleResolution | Classic | 模块解析策略 |
| moduleSuffixes | undefined | 模块后缀 |
| noResolve | false | 禁止解析模块 |
| noUncheckedSideEffectImports | undefined | 禁止未检查的副作用导入 |
| paths | undefined | 路径映射覆盖baseUrl |
| resolveJsonModule | undefined | 解析 json 模块 |
| resolvePackageJsonExports | true | 解析 package.json exports |
| resolvePackageJsonImports | true | 解析 package.json imports |
| rootDir | undefined | 根目录 |
| rootDirs | undefined | 根目录列表 |
| typeRoots | undefined | 类型根目录列表 |
| types | undefined | 类型列表 |
触发
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| declaration | true | 生成声明文件 |
| declarationDir | undefined | 声明文件输出目录 |
| declarationMap | undefined | 生成声明文件映射文件 |
| downlevelIteration | undefined | 降级迭代器 |
| emitBOM | false | 生成 BOM |
| emitDeclarationOnly | undefined | 只生成声明文件 |
| importHelpers | undefined | 导入帮助程序 |
| inlineSourceMap | undefined | 内联 sourceMap |
| inlineSources | undefined | 内联源码 |
| mapRoot | undefined | sourceMap 根目录 |
| newLine | lf | 换行符 |
| noEmit | undefined | 不生成文件 |
| noEmitHelpers | undefined | 不生成帮助程序 |
| noEmitOnError | undefined | 编译错误不生成文件 |
| outDir | undefined | 输出目录 |
| outFile | undefined | 输出文件 |
| preserveConstEnums | true | 保留常量枚举 |
| removeComments | false | 移除注释 |
| sourceMap | undefined | 生成 sourceMap |
| sourceRoot | undefined | sourceMap 根目录 |
| stripInternal | undefined | 移除内部 |
JavaScript 支持
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| allowJs | false | 允许 JavaScript |
| checkJs | undefined | 检查 JavaScript |
| maxNodeModuleJsDepth | undefined | Node.js 模块 JavaScript 层数 |
编辑器支持
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| disableSizeLimit | undefined | 禁用大小限制 |
| plugins | undefined | 插件 |
互操作约束
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| allowSyntheticDefaultImports | true | 允许合成默认导入 |
| esModuleInterop | true | ES 模块互操作 |
| forceConsistentCasingInFileNames | true | 强制文件名大小写一致性 |
| isolatedModules | true | 模块隔离 |
| preserveSymlinks | undefined | 保留符号链接 |
| verbatimModuleSyntax | undefined | 模块语法 |
语言和环境
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| JSX | preserve | 保留 JSX |
| jsxFactory | undefined | JSX 工厂 |
| jsxFragmentFactory | undefined | JSX 片段工厂 |
| jsxImportSource | react | JSX 导入源 |
| lib | undefined | 库 |
| moduleDetection | auto | 模块检测 |
| noLib | undefined | 不包含库 |
| reactNamespace | React | React 命名空间 |
| target | es5 | 目标 |
| useDefineForClassFields | true | 使用定义类字段 |
项目
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| composite | undefined | 组合 |
| disableReferencedProjectLoad | undefined | 禁用引用项目加载 |
| disableSolutionSearching | undefined | 禁用解决方案搜索 |
| disableSourceOfProjectReferenceRedirect | undefined | 禁用项目引用重定向 |
| incremental | true | 增量 |
| tsBuildInfoFile | .tsbuildinfo | ts 构建信息文件 |
输出格式
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| noErrorTruncation | undefined | 不截断错误 |
| preserveWatchOutput | undefined | 保留监视输出 |
| pretty | undefined | 代码高亮 |
完整性
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| skipLibCheck | undefined | 跳过库检查 |
类型获取 typeAcquisition
| 配置名称 | 默认值 | 说明 |
|---|---|---|
| enable | undefined | 启用 |
| include | undefined | 包含 |
| exclude | undefined | 排除 |