FRONTEND30 questions • 3 levels • ~12 min

TypeScript Deep-Dive Quiz

Select level:

30 questions covering type inference, generics, conditional types, mapped types, and modern TypeScript features.

Type Inferenceany vs unknowninterface vs typereadonlyEnumsTuples

What the TypeScript interview quiz covers

This quiz works through the parts of TypeScript that interviewers actually probe: how the compiler infers types when you do not annotate them, how generics let a function stay type-safe across many input shapes, and how the type system computes new types from existing ones with conditional types, mapped types, and the infer keyword. It also covers narrowing, how TypeScript uses control flow, typeof, instanceof, discriminated unions, and user-defined type guards to shrink a union down to a single type inside a branch.

A distinctive feature is that every answer includes the compiled JavaScript. Types, interfaces, and type-only imports are erased at build time and produce no runtime code, while enums, class parameter properties, and decorators do emit something. Seeing the emitted output next to the source makes it obvious which constructs are purely a compile-time contract and which carry a runtime cost, a distinction that comes up constantly in interviews about bundle size and performance.

The utility types, Partial, Required, Readonly, Pick, Omit, Record, ReturnType, Parameters, Awaited, and the rest, are treated as things you should be able to reimplement, not just call. Several questions ask you to predict the result of a hand-written mapped type that mirrors one of the built-ins, which is a common whiteboard exercise.

Difficulty levels

Beginner covers the everyday type system: primitive and literal types, arrays and tuples, union and intersection types, interfaces versus type aliases, optional and readonly properties, function types, and the difference between any, unknown, and never. These are the questions a screening call is most likely to open with.

Intermediate moves into generics with constraints, keyof and indexed access types, typeof used as a type query, basic mapped and conditional types, and control-flow narrowing. Advanced pushes into recursive conditional types, the infer keyword, template literal types, variadic tuple types, the satisfies operator, const type parameters, NoInfer, and module augmentation, the material that distinguishes a senior TypeScript answer.

Topics in the question bank

  • Type inference, how TypeScript assigns types to variables, return values, and generic parameters when no annotation is present, and when it widens or narrows a literal.
  • Generics, writing functions, classes, and types that are parameterised over a type, adding extends constraints, and supplying defaults.
  • Conditional and mapped types, computing one type from another with T extends U ? X : Y, key remapping, adding or removing modifiers, and distribution over unions.
  • Narrowing, reducing a union inside a branch using typeof, instanceof, in, equality checks, discriminated unions, and functions that return a type predicate.
  • Utility types, Partial, Pick, Omit, Record, ReturnType, Parameters, Awaited and friends, plus how to build equivalents by hand.
  • Compiled JavaScript output, which TypeScript syntax is erased at build time and produces no runtime code, and which syntax actually emits.

How to use the TypeScript quiz

  1. Pick a level, Beginner, Intermediate, or Advanced, from the start screen. You can take them in any order and retake each as many times as you want.
  2. Answer each multiple-choice question. Use the number keys 1 to 4 to select and Enter or the right arrow to advance.
  3. After answering, read the three explanation tabs: Why This Answer, Compiled JS, and Best Practice. The Compiled JS tab shows exactly what the TypeScript compiler emits for that snippet.
  4. Review your score at the end, then retake the level a day later to check what actually stuck.

TypeScript interview quiz FAQ

There are 30 questions in total, 10 Beginner, 10 Intermediate, and 10 Advanced. Each level is shuffled on every playthrough, so you get a fresh order each time.

Deepen your interview prep with other essential topics tested in engineering interviews.