TypeScriptのコンパイルオプションを確認するには、tsc --showConfig
すると良い。
例えば、次のようなextends
を使った設定ファイルにて、どのような設定が効いているかを知るには、継承元のtsconfig.base.json
と突き合わせてみなければならない。面倒だ。
tsconfig.json
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib"
},
"exclude": ["test"]
}
tsconfig.base.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": ["packages/*/src"]
},
"outDir": "SHOULD_BE_OVERWRITE",
"declaration": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"module": "commonjs",
"newLine": "LF",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"removeComments": false,
"sourceMap": true,
"strict": true,
"target": "esnext"
}
}
そういう場合では、tsc --showConfing
を叩くと、extends
などが評価された状態の設定値を確認できる。
以下が出力結果の例:
{
"compilerOptions": {
"baseUrl": "../..",
"paths": {
"*": [
"packages/*/src"
]
},
"outDir": "./lib",
"declaration": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"module": "commonjs",
"newLine": "lf",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"removeComments": false,
"sourceMap": true,
"strict": true,
"target": "esnext"
},
"files": [
"./lib/Applicant.d.ts",
"./lib/ApplicantRow.d.ts",
"./lib/Applicants.d.ts",
"./lib/ApplicantsImpl.d.ts",
"./lib/ParticipationPage.d.ts",
"./lib/getConnpassApplicants.d.ts",
"./lib/index.d.ts",
"./src/Applicant.ts",
"./src/ApplicantRow.ts",
"./src/Applicants.ts",
"./src/ApplicantsImpl.ts",
"./src/ParticipationPage.ts",
"./src/getConnpassApplicants.ts",
"./src/index.ts"
],
"exclude": [
"test"
]
}
--showConfig
はTypeScript 3.2で導入された。