THN Interview Prep

TypeScript at scale

Core details

TypeScript is JavaScript + static types erased at emit—runtime is still JS semantics. Structural typing: shapes matter; nominal brands need tricks.

TypeScript type-boundary workflow showing source, type checking, erased JavaScript runtime, public API contracts, IO validation, and CI strictness controls.

KnobEffect
strict familyfewer any holes; more friction up front
noUncheckedIndexedAccesssafer obj[k]
strictNullChecksnull/undefined in type flow

Inference: let the compiler infer locals; annotate exports and public APIs for stable contracts.

Patterns: discriminated unions for state machines; satisfies to keep literal types; avoid any—prefer unknown + narrowing.

Understanding

interface vs type: merge declaration with interface; unions/maps often need type. Teams pick one consistency rule.

Build modes: project references for monorepo compile graphs; path aliases need runtime resolution strategy (bundler).

Senior understanding

Types don’t catch all bugs: IO boundaries still need validation (zod/io-ts). Generic abuse hurts readability—balance reuse vs clarity.

See also

Mark this page when you finish learning it.

Last updated on

Spotted something unclear or wrong on this page?

On this page