Skip to main content

TypeScript interview questions that test the type system, not trivia

EH
Expert Hire Team
August 18, 2026
TypeScript interview questions that test the type system, not trivia
Share this article

TypeScript interview questions are prompts that probe how a candidate uses TypeScript's type system, not just JavaScript with annotations. The good ones test judgment: narrowing unions, constraining generics, and choosing unknown over any. That judgment, not definition recall, predicts who writes safe TypeScript in production.

Most typescript interview questions and answers online are flat lists with no way to tell a strong response from a memorized one. This is a leveled set instead: junior, mid, and senior questions, each with a model answer and a scoring note.

Key Takeaways

  • The most predictive TypeScript questions are about the type system and judgment, not syntax or "what is an interface."

  • The real signal is whether a candidate reasons with types (narrowing, generics, unknown over any) or just annotates variables.

  • A leveled set (junior, mid, senior) with model answers and scoring notes lets a non-expert run a fair screen.

  • The type system under real constraints (generics, conditional and utility types, narrowing) is where TypeScript interviews separate people fast.

  • The strongest answers survive a follow-up. A memorized definition rarely does.

What typescript interview questions actually test in 2026

A TypeScript interview is not a syntax quiz. What takes longer than syntax is judgment: choosing unknown over any, narrowing a union safely, constraining a generic, and knowing that TypeScript's types are structural, not nominal.

Structured, rubric-based scoring predicts job performance far better than an unstructured chat, per Schmidt and Hunter's meta-analysis. That is why every question below carries a scoring note. It is the rubric logic behind our question library and structured interview software.

Junior typescript interview questions

These check that a candidate can be trusted in a codebase without constant review.

  • What is the difference between any and `unknown`? any turns off type checking entirely, so the compiler stays silent on any access or call. unknown also holds any value, but you cannot use it until you narrow it, which makes it right for JSON.parse output, API responses, and catch clauses.

  • What is the difference between interface and `type`? Both describe an object's shape and both can be extended. But an interface supports declaration merging, while a type alias can express unions, tuples, and mapped types that an interface cannot.

  • What is a union type, and how do you narrow it? A union like string | number means the value is one of several types, and you narrow it with a guard such as typeof x === "string", Array.isArray, or instanceof. Inside that guarded block, control-flow analysis treats the value as the narrowed type.

Scoring note: a junior who calls unknown "just a newer any" is memorizing. The one who says it forces a check where outside data enters has used it.

Mid-level typescript interview questions

These add generics and utility types, and reveal whether someone has written real TypeScript or only read about it.

  • What is structural typing? TypeScript compares types by shape, not by name: an object is assignable to a type if it has every member that type requires, with no declared relationship. A strong answer contrasts nominal typing in Java or C#, and cites excess property checks on object literals as the deliberate exception.

  • What are generics, and why use them? Generics parameterize a function or type over a type, preserving the link between input and output, so function first<T>(arr: T[]): T returns the exact element type instead of any. A strong answer adds a constraint like <T extends { id: string }> and frames generics as relationships between types, not just reuse.

  • What do utility types like `Partial`, `Pick`, and Omit do? They transform existing types: Partial<T> makes properties optional, Pick<T, K> selects keys, Omit<T, K> removes them, and Record<K, V> maps keys to a value type. The tell is knowing these are just mapped types, so Partial<T> is { [P in keyof T]?: T[P] }, not magic.

  • What is a discriminated union? A union of object types sharing a literal property, like { kind: "circle"; radius: number } | { kind: "square"; side: number }, where switching on kind narrows to the exact member. A strong answer adds a never check in the default case, so a new variant becomes a compile error.

Scoring note: the utility-types question separates people. Listing them is fine, but the candidate who rebuilds Partial as a mapped type understands what a utility type is.

Senior typescript interview questions

These advanced typescript interview questions test whether someone treats TypeScript as a language for computing types, not just annotating them.

  • What are conditional types, and what does infer do? A conditional type picks a branch by a relationship, T extends U ? X : Y, and infer captures part of a type inside that condition. So T extends (infer E)[] ? E : T extracts an array's element type, and the built-in ReturnType<T> works the same way, roughly T extends (...args: any[]) => infer R ? R : never.

  • What is the difference between a type guard and an assertion function? A user-defined guard returns arg is Type and narrows where it returns true. An assertion function is typed asserts arg is Type and narrows by throwing when the check fails, which is why it needs an explicit return-type annotation.

  • What does as const do? A const assertion infers the narrowest, readonly, literal type, so "a" stays the literal "a" instead of widening to string, and an array becomes a readonly tuple. A strong answer pairs it with typeof arr[number] to derive a string-literal union from an array.

Scoring note: conditional types with infer are the deep end. A candidate who can write ReturnType from scratch understands the type system as a small language, the senior signal for typescript interview questions for experienced engineers.

The hardest area: the type system under real constraints

If you have time for one theme, make it the type system under real constraints: generics, conditional and utility types, and narrowing, not "what is an interface." It is where TypeScript is distinctive and where weak candidates fall apart.

The best typescript coding interview questions use a concrete scenario, not a definition. Try this: write a pluck function that takes an array of objects and a key and returns the values at that key, so a wrong key is a compile error and the return type is exact.

The idiomatic answer is function pluck<T, K extends keyof T>(objects: T[], key: K): T[K][]. A weak answer types the key as string and the return as any[], throwing away everything TypeScript could catch. A strong one explains why the constraint and the indexed access T[K] matter, then handles the follow-up (given string | string[], normalize with Array.isArray) without reaching for any.

You do not need perfect whiteboard code. You need the candidate to reason about constraints, inference, and narrowing. Anchor your model answers to the TypeScript documentation so they track the current language.

How to score a typescript answer: reasoning or reciting

The rubric across every level is simple: is the candidate reasoning with types, or reciting definitions? Someone who reaches for any to silence an error is annotating; someone who narrows, constrains a generic, and picks unknown at the boundary is reasoning.

Score each answer against a defined anchor, not a gut feeling. A strong answer names the trade-off and the edge case (structural typing's excess-property check, the never exhaustiveness trick), an average one gives the definition, and a weak one recites a keyword.

Our scoring methodology walks through a worked rubric, and every round scores onto one report card, so a human and an AI round stay comparable.

How to run a typescript screen when no one on your team writes typescript

This is a real situation: a recruiter or hiring manager from another stack needs to screen TypeScript candidates. The fix is a structured set with an explicit scoring guide, which is what this page is, the principle behind any structured technical interview.

Judging whether the reasoning holds up is where an AI interview platform helps. Expert Hire's Coding round is a short voice interview (about 20 minutes plus follow-ups) with a live code editor, run by the AI interviewer Ethan, who asks adaptive follow-ups and produces a scorecard your engineer reviews quickly.

Candidates can practice on the same engine that runs the hiring round, so prep and the real screen share one rubric. That consistency makes the result defensible, and bodies like the US Office of Personnel Management recommend structured interviews.

Frequently asked questions

What are the most common TypeScript interview questions? The most common ones cover any versus unknown, interface versus type, generics, the utility types, and union narrowing. Frequency is not value, though: generics, narrowing, and structural typing separate candidates far better than definitional trivia.

What are the 10 main TypeScript interview questions to prepare? A solid ten span the tiers: any versus unknown, interface versus type, union narrowing, structural typing, generics, utility types, discriminated unions, conditional types with infer, guards versus assertion functions, and as const. Prepare a real example for each, since the follow-up is where memorized answers fail.

What are 7 good TypeScript interview questions for a first round? Seven is enough to place a candidate: any versus unknown, a constrained generic, utility types, a discriminated union with exhaustiveness, structural typing, a keyof signature, and the pluck coding exercise.

What should advanced TypeScript interview questions for experienced developers cover? Focus on conditional types and infer, assertion functions, as const and literal inference, constrained generics with keyof, and variance. These show up when you build reusable, type-safe APIs, separating engineers who have shipped TypeScript from those who only studied it.

Can you screen TypeScript candidates without a TypeScript expert on the panel? Yes, with a structured set that pairs each question with a model answer and a scoring note. It lets a non-expert run a consistent first round and hand a clear scorecard to the engineer who makes the final call.

The bottom line

The best TypeScript interview is not the longest question list. It is a leveled set where you know, before the candidate answers, what a strong response contains. The type system is the signal; trivia is noise.

Weight the generics and narrowing answers heavily, and you separate engineers who reason with types from those who write JavaScript with annotations. To see a structured, rubric-scored TypeScript round, look at a sample candidate scorecard on the AI interview platform and judge whether the reasoning holds up.

Ready to Transform Your Hiring?

Start your free trial to see how Expert Hire can help you screen candidates faster and smarter.

Share this article