Interview Q&A · questions with model answers
TypeScript Developer Interview Questions
Part of the study plan for: Frontend Engineer · Full Stack Engineer
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked Why do you still need runtime validation in TypeScript, and how do libraries like Zod help?
TypeScript types vanish at runtime, so data from APIs, forms, env vars or JSON.parse isn't actually checked. Schema libraries (Zod, Valibot, ArkType) validate data at runtime and infer static types…
-
Why does `Object.keys(obj)` return `string[]` instead of `(keyof T)[]`?
Because of structural typing, an object may have more properties at runtime than its static type declares, so claiming the keys are exactly keyof T would be unsound.
-
Why does `Omit` behave unexpectedly on union types, and how do you fix it?
Omit<A | B, 'k'> operates on keyof (A | B), which only includes keys common to all members, so variant-specific properties are lost. A distributive version applies Omit to each member separately.
-
Why should you avoid the `Function` type?
Function accepts any callable but calling it returns any and doesn't check arguments, so it disables type safety. Use specific signatures like (...args: unknown[]) => unknown or (id: string) =>…
-
Why are classes with private members compared nominally?
If a class has private or protected members, another type is only compatible if those members originate from the same declaration, so two structurally identical classes with private fields aren't…
-
Why combine `as const` with `satisfies`?
as const satisfies T gives you deep literal, readonly types (for precise inference and derived unions) while still checking the value against a schema type, so typos and missing fields are caught.
-
Why can a function with fewer parameters be assigned to a function type with more parameters?
Callers may pass extra arguments that the function simply ignores, which is safe in JavaScript, so TypeScript allows (a) => void where (a, b, c) => void is expected (e.g., array.forEach(item => ...)…