TypeScript rewards people who understand that types are a design tool, not annotations to satisfy the compiler. These questions tell the two apart.
Hiring a TypeScript developer is easy. Telling a real one from a convincing résumé is the hard part — and it’s most of what we do. These are grouped by level, because the same question that stretches a junior is a warm-up for a senior.
Junior TypeScript interview questions
0–2 years
Basic types and everyday usage.
What problems does TypeScript solve over JavaScript?
Static typing catches a class of bugs at compile time, improves editor tooling and refactoring, and documents intent; it compiles away to plain JS.
Thinks TypeScript changes runtime behaviour.
What is the difference between interface and type?
Both describe object shapes; interfaces are open to declaration merging and extension, while type aliases can express unions, intersections and mapped types. Largely interchangeable for objects.
Insists one is strictly better with no nuance.
What are any, unknown and never?
any opts out of checking, unknown is safe-any that must be narrowed before use, never represents values that can’t occur.
Reaches for any as the default fix for type errors.
What are union and intersection types?
A union (A | B) is one of several types; an intersection (A & B) combines them. They know unions need narrowing before member access.
Confuses which operator does which.
What does the ? optional modifier do?
Marks a property or parameter as possibly undefined; the value must be checked before use under strictNullChecks.
Ignores that optional means possibly undefined.
What is type inference?
The compiler deduces types from usage, so explicit annotations aren’t always needed; over-annotating adds noise.
Annotates everything, including obvious inferred types, or annotates nothing.
What is an enum, and are there alternatives?
A named set of constants; union of string literals is often preferred for tree-shaking and simplicity.
Unaware of literal-union alternatives.
What does readonly do?
Prevents reassignment of a property at compile time; it is not deep and disappears at runtime.
Thinks readonly deep-freezes at runtime.
Mid-level TypeScript interview questions
2–5 years
Generics and narrowing.
What are generics and why use them?
Type parameters that let a function or type work over many types while preserving the relationship between inputs and outputs; the alternative is losing type safety with any.
Uses any where a generic would keep type information.
How does type narrowing work?
Control-flow analysis narrows a union with typeof, instanceof, in, equality checks and discriminated unions, so member access is safe within a branch.
Casts with as instead of narrowing properly.
What is a discriminated union?
A union of object types sharing a literal kind/type tag, letting the compiler narrow exhaustively in a switch. Pairs well with a never exhaustiveness check.
Models variants with optional fields and lots of null checks instead.
What do keyof and indexed access types do?
keyof T yields the union of T’s keys; T[K] gets the type of a property, enabling type-safe generic accessors.
Never uses them and hardcodes key strings.
What is the difference between as and a type guard?
as is an unchecked assertion that can lie to the compiler; a type guard actually narrows based on a runtime check.
Sprinkles as to silence errors.
What are utility types like Partial, Pick, Omit?
Built-in mapped types that transform existing types — making properties optional, selecting or excluding keys — reducing duplication.
Rewrites derived types by hand and lets them drift.
How do you type an async function’s return?
It returns a Promise<T>; the resolved type is T. They know await unwraps it.
Types the return as the resolved value without the Promise wrapper.
What is structural typing?
TypeScript compares types by shape, not by name, so any object with the required members is assignable. They understand duck typing implications.
Assumes nominal typing like Java/C#.
Senior TypeScript interview questions
5+ years
Advanced types and config.
What are conditional and mapped types?
Types that branch (T extends U ? X : Y) or transform each property of a type; the basis for the utility types and powerful library APIs.
Cannot read or write a mapped/conditional type.
What do infer and template literal types enable?
infer extracts a type within a conditional type (e.g. a promise’s resolved type); template literal types build string types compositionally.
No exposure to type-level programming.
How do you configure strictness and why?
Enable strict (which includes strictNullChecks, noImplicitAny, etc.) to catch the most bugs; loosening it should be a deliberate, local decision.
Ships with strict off to avoid fixing errors.
How do you type third-party JS without types?
Write or install declaration files (.d.ts), use module augmentation, and avoid blanket any.
Casts everything from the library to any.
What is declaration merging and when is it useful?
The compiler merges multiple declarations of the same interface/namespace, useful for extending library types or global augmentation.
Unaware it exists.
How do generics with constraints work?
<T extends U> restricts the type parameter so you can safely access members of U while staying generic.
Writes unconstrained generics then casts inside.
What is variance and why does it matter for function types?
Parameters are contravariant and return types covariant in sound reasoning; getting it wrong causes unsafe assignments. They can reason about assignability.
No concept of variance; assigns incompatible function types.
How do you keep type-checking fast in a large repo?
Project references, incremental builds, avoiding pathological conditional types, and typing boundaries rather than everything.
Lets build times balloon with no strategy.
Build and score a full interview with our free interview scorecard tool, browse the full question hub, or see how we interview engineers.