调试相关的选项。

allowUnreachableCode

默认:undefined
选项:

  • undefined (default) 编辑器提供warning
  • true unreachable 代码会忽略
  • false unreachable 代码会报错
  1. function fn(n: number) {
  2. if (n > 5) {
  3. return true;
  4. } else {
  5. return false;
  6. }
  7. return true;
  8. // error: Unreachable code detected.
  9. }

allowUnusedLabels

默认:undefined
选项:

  • undefined (default) 编辑器提供warning
  • true unused labels 代码会忽略
  • false unused labels 代码会报错
  1. function verifyAge(age: number) {
  2. // Forgot 'return' statement
  3. if (age > 18) {
  4. verified: true;
  5. // error: Unused label.
  6. }
  7. }

assumeChangesOnlyAffectDirectDependencies

当这个选项被启用时,TypeScript将避免重新检查/重建所有真正可能受到影响的文件,而只会重新检查/重建已经发生变化的文件以及直接导入它们的文件。

这可以被认为是监视算法的一个“快速而松散”的实现,它可以极大地减少增量重建时间,代价是必须偶尔运行完整构建以获得所有编译器错误消息。

charset

  • 弃用
  • 默认:utf8

declarationDir

声明文件的文件位置

  1. {
  2. "compilerOptions": {
  3. "declaration": true,
  4. "declarationDir": "./types"
  5. }
  6. }

types 文件夹里放置声明文件 index.d.ts

  1. example
  2. ├── index.js
  3. ├── index.ts
  4. ├── package.json
  5. ├── tsconfig.json
  6. └── types
  7. └── index.d.ts

diagnostics

  • 弃用
  • 默认:false

用于输出诊断信息进行调试。

disableReferencedProjectLoad

disableSizeLimit,
disableSolutionSearching,
disableSourceOfProjectReferenceRedirect,
emitBOM,
emitDeclarationOnly,

explainFiles

extendedDiagnostics

forceConsistentCasingInFileNames,
generateCpuProfile,
importsNotUsedAsValues,
jsxFactory,
jsxFragmentFactory,
jsxImportSource,
keyofStringsOnly,
listEmittedFiles,
listFiles,
maxNodeModuleJsDepth,
newLine,
noEmitHelpers,
noEmitOnError,
noErrorTruncation,
noImplicitUseStrict,
noLib,
noResolve,
noStrictGenericChecks,
out,
preserveConstEnums,
reactNamespace,
resolveJsonModule,
skipDefaultLibCheck,
skipLibCheck,
stripInternal,
suppressExcessPropertyErrors,
suppressImplicitAnyIndexErrors,

traceResolution

跟踪为什么debug某模块却没有被包含的原因。
具体可以看:Tracing module resolution

useDefineForClassFields