generated at
2/15/2025, 6:55:12 PM
tsconfigのstrict関連のoption
docs
strict
以下の項目を全て
true
にする
stirct: true
にした上で、下の項目を部分的にfalseにもできる
strict
じゃないもののほうが優先される
TypeScript v4.6
の時点では以下の8つ
noImplicitAny
暗黙のanyを禁止
https://typescript-jp.gitbook.io/deep-dive/intro/noimplicitany
strictNullChecks
厳密なnullチェック
undefinedプロパティにアクセスする前はnullチェックを強制するとか
https://typescriptbook.jp/reference/tsconfig/strictnullchecks
strictFunctionTypes
関数代入時の型checkを厳格にする
alwaysStrict
use strict
を全てのファイルの先頭行に付与する
https://typescriptbook.jp/reference/tsconfig/alwaysstrict
noImplicitThis
暗黙的に
any
となる
this
の禁止
https://typescriptbook.jp/reference/tsconfig/noimplicitthis
strictBindCallApply
bind
,
call
,
apply
を使用する際に、より厳密に型チェックが行われるようになる
strictPropertyInitialization
useUnknownInCatchVariables
https://typescriptbook.jp/reference/tsconfig
https://qiita.com/ryokkkke/items/390647a7c26933940470#strict