strict: true bật nhiều checks: strictNullChecks (null/undefined không assign cho typed vars), strictFunctionTypes, strictPropertyInitialization, noImplicitAny, noImplicitThis, strictBindCallApply. Luôn bật strict: true cho dự án mới. Khi migrate JS sang TS có thể bật từng flag dần.
Lưu ý: TS 4.4 thêm useUnknownInCatchVariables vào strict — catch variable từ any chuyển thành unknown, bắt buộc narrow trước khi dùng. Điều này thường làm bối rối khi migrate dự án cũ.
strict: true enables multiple checks: strictNullChecks (null/undefined cannot be assigned to typed vars), strictFunctionTypes, strictPropertyInitialization, noImplicitAny, noImplicitThis, strictBindCallApply. Always enable strict: true for new projects. When migrating from JS to TS, you can enable flags incrementally.
Note: TS 4.4 added useUnknownInCatchVariables to strict — catch variables changed from any to unknown, requiring narrowing before use. This often surprises developers migrating older projects.