What does strict mode do in TypeScript?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid TypeScript basics — a prerequisite for any developer role.

Answer

Setting "strict": true in tsconfig.json enables a collection of strict type-checking options that significantly improve type safety. It enables these sub-options: noImplicitAny — error when TypeScript infers any because a type cannot be determined. strictNullChecksnull and undefined are no longer assignable to other types unless explicitly included; you must handle them. strictFunctionTypes — stricter checking of function parameter types (contravariance). strictBindCallApply — type-safe bind, call, and apply on functions. strictPropertyInitialization — class properties must be assigned in the constructor. noImplicitThis — error when this has an implicit any type. alwaysStrict — emits "use strict" in all output files. Best practice: always enable "strict": true from the start of a project. Retrofitting strict mode onto an existing codebase is painful — do it early.

Common Mistake

Many candidates answer correctly but can't explain the 'why'. Always be prepared to justify your answer with a concrete example or use case from your TypeScript experience.