Skip to content

顶层配置 ​

配置名称默认值说明
filesfalse待编译文件列表
extendsfalse继承配置文件
includefalse待编译文件 glob 模式列表
excludefalse排除文件 glob 模式列表
referencesfalse引用配置文件列表

类型检查 ​

配置名称默认值说明
allowUnreachableCodeundefined允许代码块内未使用的代码
allowUnusedLabelsundefined允许未使用的标签
alwaysStrictundefined启用严格模式
exactOptionalPropertyTypesundefined启用精确可选属性类型
noFallthroughCasesInSwitchundefined禁止 switch 语句 fallthrough
noImplicitAnytrue禁止隐式 any 类型
noImplicitOverrideundefined禁止使用 override 修饰符
noImplicitReturnsundefined禁止隐式返回类型
noImplicitThistrue禁止隐式 this 类型
noPropertyAccessFromIndexSignatureundefined禁止通过索引签名访问属性
noUncheckedIndexedAccessundefined禁止使用未检查的索引访问
noUnusedLocalsundefined禁止未使用的局部变量
noUnusedParametersundefined禁止未使用的参数
strictundefined启用严格模式
strictBindCallApplytrue启用严格绑定调用和应用
strictBuiltinIteratorReturnfalse启用严格内置迭代器返回
strictFunctionTypestrue启用严格函数类型
strictNullCheckstrue启用严格空检查
strictPropertyInitializationtrue启用严格属性初始化
useUnknownInCatchVariablestrue启用未知类型在 catch 块中变量

模块 ​

配置名称默认值说明
allowArbitraryExtensionstrue允许使用任意扩展名
allowImportingTsExtensionsundefined允许导入 .ts 文件
allowUmdGlobalAccessundefined允许访问 UMD 全局变量
baseUrlundefined模块解析的根目录
customConditionsundefined自定义条件
moduleCommonJS模块类型
moduleResolutionClassic模块解析策略
moduleSuffixesundefined模块后缀
noResolvefalse禁止解析模块
noUncheckedSideEffectImportsundefined禁止未检查的副作用导入
pathsundefined路径映射覆盖baseUrl
resolveJsonModuleundefined解析 json 模块
resolvePackageJsonExportstrue解析 package.json exports
resolvePackageJsonImportstrue解析 package.json imports
rootDirundefined根目录
rootDirsundefined根目录列表
typeRootsundefined类型根目录列表
typesundefined类型列表

触发 ​

配置名称默认值说明
declarationtrue生成声明文件
declarationDirundefined声明文件输出目录
declarationMapundefined生成声明文件映射文件
downlevelIterationundefined降级迭代器
emitBOMfalse生成 BOM
emitDeclarationOnlyundefined只生成声明文件
importHelpersundefined导入帮助程序
inlineSourceMapundefined内联 sourceMap
inlineSourcesundefined内联源码
mapRootundefinedsourceMap 根目录
newLinelf换行符
noEmitundefined不生成文件
noEmitHelpersundefined不生成帮助程序
noEmitOnErrorundefined编译错误不生成文件
outDirundefined输出目录
outFileundefined输出文件
preserveConstEnumstrue保留常量枚举
removeCommentsfalse移除注释
sourceMapundefined生成 sourceMap
sourceRootundefinedsourceMap 根目录
stripInternalundefined移除内部

JavaScript 支持 ​

配置名称默认值说明
allowJsfalse允许 JavaScript
checkJsundefined检查 JavaScript
maxNodeModuleJsDepthundefinedNode.js 模块 JavaScript 层数

编辑器支持 ​

配置名称默认值说明
disableSizeLimitundefined禁用大小限制
pluginsundefined插件

互操作约束 ​

配置名称默认值说明
allowSyntheticDefaultImportstrue允许合成默认导入
esModuleInteroptrueES 模块互操作
forceConsistentCasingInFileNamestrue强制文件名大小写一致性
isolatedModulestrue模块隔离
preserveSymlinksundefined保留符号链接
verbatimModuleSyntaxundefined模块语法

语言和环境 ​

配置名称默认值说明
JSXpreserve保留 JSX
jsxFactoryundefinedJSX 工厂
jsxFragmentFactoryundefinedJSX 片段工厂
jsxImportSourcereactJSX 导入源
libundefined库
moduleDetectionauto模块检测
noLibundefined不包含库
reactNamespaceReactReact 命名空间
targetes5目标
useDefineForClassFieldstrue使用定义类字段

项目 ​

配置名称默认值说明
compositeundefined组合
disableReferencedProjectLoadundefined禁用引用项目加载
disableSolutionSearchingundefined禁用解决方案搜索
disableSourceOfProjectReferenceRedirectundefined禁用项目引用重定向
incrementaltrue增量
tsBuildInfoFile.tsbuildinfots 构建信息文件

输出格式 ​

配置名称默认值说明
noErrorTruncationundefined不截断错误
preserveWatchOutputundefined保留监视输出
prettyundefined代码高亮

完整性 ​

配置名称默认值说明
skipLibCheckundefined跳过库检查

类型获取 typeAcquisition ​

配置名称默认值说明
enableundefined启用
includeundefined包含
excludeundefined排除