"strict": true ing tsconfig.json ngaktifake kulawarga ndeleng pemeriksaan sing luwih ketat sekali. Iki luwih banget diarepake kanggo kabeh proyek anyar — iki nyekel bug-bug sing TypeScript ana kanggo dicegah.
// strictNullChecks — null/undefined are no longer assignable to everything
let name: string = null; // ❌ Error (without strict this compiles, then crashes)
function f(u?: User) { u.name; } // ❌ u is possibly undefined → forces a check
// noImplicitAny — parameters with no inferable type must be annotated
function g(x) {} // ❌ Error: 'x' implicitly has type 'any'
// strictPropertyInitialization — class fields must be initialized
class C { name: string; } // ❌ must init in constructor or mark optional
strictNullChecks minangka sing gedhe: iku misahake null/undefined saka tipe liyane, mula compiler ngejag sampeyan kanggo nangani "bisa ono sing ilang" ing njerone-njerone — ngilangi kelas #1 saka runtime errors ("cannot read property of undefined").
Ubah bendera-bendera sakabehane (strictNullChecks pisanan), benahi errors berkas demi berkas, tinimbang ngaktifake kabeh saengga-engga ing proyek legacy sing gedhe.
Tanpa strict mode, TypeScript isih ngidini akeh-akehe pola-pola sing ora aman sing iki dimaksud kanggo dicegah (implicit any, unchecked nulls).
Strict mode minangka ngendi TypeScript ngirim akeh-akehe nilai-nilai — tanggapi iku minangka standar lan mung santai bendera individual karo alasan sing apik.