TypeScript Developer interview question · Most asked
Which `tsconfig` strictness options matter and what do they catch?
Summary
strict: true enables strictNullChecks, noImplicitAny, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, useUnknownInCatchVariables, alwaysStrict and noImplicitThis. Extra recommended flags: noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitOverride and noFallthroughCasesInSwitch.
Longer Answer
strictNullChecks is the most valuable: it forces handling null/undefined. noUncheckedIndexedAccess makes arr[i] and record[key] return T | undefined, catching out-of-bounds bugs. When migrating a large JS codebase, enable strict flags incrementally.
Key Points
strict: truebundlestrictNullChecksis the biggest winnoUncheckedIndexedAccessfor index safety- Adopt incrementally in migrations
More most-asked TypeScript Developer questions
- Explain `any`, `unknown` and `never`.
- What are the differences between `interface` and `type` aliases?
- What is structural typing in TypeScript?
- What is type narrowing and what techniques does TypeScript support?
- What are discriminated unions and why are they powerful?
- What are generics and how do constraints work?
- Which built-in utility types do you use most, and what do they do?
- What is TypeScript and what problems does it solve?