Cheat Sheets

TypeScript Interview Questions Cheat Sheet: Types vs Interfaces, never & Generics

By ArpaNeuro Team September 20, 2026
TypeScript interview cheat sheet

TypeScript interviews test whether you understand structural typing, the difference between any and unknown, and that types disappear at runtime. Be ready to narrow a union, write a small generic pick, and explain never in exhaustive switch statements. Framework trivia is secondary.

This TypeScript cheat sheet is written for people searching for a fast, accurate reference: students, junior developers, and teams shipping production software. Pin it, copy the snippets, and come back when syntax slips.

Quick reference

  • Structural: If it has the required fields, it matches — no nominal implements required (though you can).
  • any: Disables checking. Contagious. Avoid on public APIs.
  • unknown: Must narrow. The safe top type for untrusted JSON.
  • never: Values that cannot exist. Exhaustive checks assign leftover unions to never.
  • Erase: Interfaces, generics, and types are compile-time. typeof operator in JS is runtime.
  • Narrow: typeof, in, equality on a discriminant, type predicates is.
  • interface vs type: Merging vs unions — give one example of each.
  • satisfies: Check a value against a type without widening (TS 4.9+).

Copy-paste examples

Exhaustiveness with never

If you add a status and forget a case, assertNever fails typecheck.

type Status = 'open' | 'closed';
function assertNever(x: never): never {
  throw new Error('Unexpected ' + x);
}
export function label(s: Status): string {
  switch (s) {
    case 'open':
      return 'Open';
    case 'closed':
      return 'Closed';
    default:
      return assertNever(s);
  }
}

Common mistakes

  • Saying TypeScript is a runtime validator like Zod (unless you added Zod).
  • Cannot explain why as User on JSON is a lie.
  • Using enum without knowing it emits JS objects (unless as const union).
  • Claiming interface is faster at runtime — there is no runtime.

FAQ

  1. Is TypeScript object-oriented? It supports classes and interfaces, and also functional styles. Structural typing is the key difference from Java’s nominal types.
  1. What is declaration merging? Multiple interface with the same name combine. Useful for patching libs; surprising in app code.
  1. How do you type BLOGPH0 extras? An interface Window { analytics?: ... } in a .d.ts. Do not as any the whole window.

Related TypeScript cheat sheets

Build with this stack

When a cheat sheet is not enough — you need a production app, a student FYP, or a custom dashboard — ArpaNeuro builds custom web development and also sells ready-made source code. Request a quote and tell us the stack.

Browse software development services or the source code marketplace if you want a working codebase instead of starting from a blank file.

← All Articles Get a Quote →