TypeScript
ts/strict
TypeScript runs with strict on; no config turns strict or one of its checks (strictNullChecks, noImplicitAny...) off.
moderatestaticfe-typescript
Why
Without strictNullChecks, every value may silently be null or undefined and the compiler never says so; without noImplicitAny, untyped parameters turn checking off where it matters most. Most "Cannot read properties of undefined" errors in production are what strict mode reports at build time.
Fix
Remove "strict": false and any strict flag set to false. TypeScript 6.0 and later turn strict on by default; on 5.x write "strict": true. In a large old codebase, turn it on and silence the existing errors file by file with // @ts-expect-error and a reason, so new code is strict from today.
Examples
// bad
{ "compilerOptions": { "strict": false } }
{ "compilerOptions": { "strict": true, "strictNullChecks": false } }
// good
{ "compilerOptions": { "strict": true, "noUncheckedIndexedAccess": true } }Sources
Facts
- Id
ts/strict- Severity
- moderate
- Check
- static checked in the source by
audit - Applies to
project- Only in projects with
typescript- Taught by the skill
fe-typescriptTypeScript- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain ts/strict