tsconfigをガチガチにする
どうやって確認するか?
docsの「Type Checking」の項目を全部
true
にすれば良い
v4.6.json // strict
"strict": true,
// "noImplicitAny": true,
// "strictNullChecks": true,
// "strictFunctionTypes": true,
// "alwaysStrict": true,
// "noImplicitThis": true,
// "strictBindCallApply": true,
// "strictPropertyInitialization": true,
// "useUnknownInCatchVariables": true,
// strict以外
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
コメントアウトしている部分はstrictに含まれるので書く必要がない

ただ、tsconfigの中で順序を気にせずに書いていると、気づかずに紛れ込んでいる可能性があるので、それに気付くためにここでは敢えて書いている