TypeScript Interview Questions (2026): By Level, With Model Answers

How to use this

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?

What a strong answer covers

Static typing catches a class of bugs at compile time, improves editor tooling and refactoring, and documents intent; it compiles away to plain JS.

Red flag

Thinks TypeScript changes runtime behaviour.

What is the difference between interface and type?

What a strong answer covers

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.

Red flag

Insists one is strictly better with no nuance.

What are any, unknown and never?

What a strong answer covers

any opts out of checking, unknown is safe-any that must be narrowed before use, never represents values that can’t occur.

Red flag

Reaches for any as the default fix for type errors.

What are union and intersection types?

What a strong answer covers

A union (A | B) is one of several types; an intersection (A & B) combines them. They know unions need narrowing before member access.

Red flag

Confuses which operator does which.

What does the ? optional modifier do?

What a strong answer covers

Marks a property or parameter as possibly undefined; the value must be checked before use under strictNullChecks.

Red flag

Ignores that optional means possibly undefined.

What is type inference?

What a strong answer covers

The compiler deduces types from usage, so explicit annotations aren’t always needed; over-annotating adds noise.

Red flag

Annotates everything, including obvious inferred types, or annotates nothing.

What is an enum, and are there alternatives?

What a strong answer covers

A named set of constants; union of string literals is often preferred for tree-shaking and simplicity.

Red flag

Unaware of literal-union alternatives.

What does readonly do?

What a strong answer covers

Prevents reassignment of a property at compile time; it is not deep and disappears at runtime.

Red flag

Thinks readonly deep-freezes at runtime.

Mid-level TypeScript interview questions

2–5 years

Generics and narrowing.

What are generics and why use them?

What a strong answer covers

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.

Red flag

Uses any where a generic would keep type information.

How does type narrowing work?

What a strong answer covers

Control-flow analysis narrows a union with typeof, instanceof, in, equality checks and discriminated unions, so member access is safe within a branch.

Red flag

Casts with as instead of narrowing properly.

What is a discriminated union?

What a strong answer covers

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.

Red flag

Models variants with optional fields and lots of null checks instead.

What do keyof and indexed access types do?

What a strong answer covers

keyof T yields the union of T’s keys; T[K] gets the type of a property, enabling type-safe generic accessors.

Red flag

Never uses them and hardcodes key strings.

What is the difference between as and a type guard?

What a strong answer covers

as is an unchecked assertion that can lie to the compiler; a type guard actually narrows based on a runtime check.

Red flag

Sprinkles as to silence errors.

What are utility types like Partial, Pick, Omit?

What a strong answer covers

Built-in mapped types that transform existing types — making properties optional, selecting or excluding keys — reducing duplication.

Red flag

Rewrites derived types by hand and lets them drift.

How do you type an async function’s return?

What a strong answer covers

It returns a Promise<T>; the resolved type is T. They know await unwraps it.

Red flag

Types the return as the resolved value without the Promise wrapper.

What is structural typing?

What a strong answer covers

TypeScript compares types by shape, not by name, so any object with the required members is assignable. They understand duck typing implications.

Red flag

Assumes nominal typing like Java/C#.

Senior TypeScript interview questions

5+ years

Advanced types and config.

What are conditional and mapped types?

What a strong answer covers

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.

Red flag

Cannot read or write a mapped/conditional type.

What do infer and template literal types enable?

What a strong answer covers

infer extracts a type within a conditional type (e.g. a promise’s resolved type); template literal types build string types compositionally.

Red flag

No exposure to type-level programming.

How do you configure strictness and why?

What a strong answer covers

Enable strict (which includes strictNullChecks, noImplicitAny, etc.) to catch the most bugs; loosening it should be a deliberate, local decision.

Red flag

Ships with strict off to avoid fixing errors.

How do you type third-party JS without types?

What a strong answer covers

Write or install declaration files (.d.ts), use module augmentation, and avoid blanket any.

Red flag

Casts everything from the library to any.

What is declaration merging and when is it useful?

What a strong answer covers

The compiler merges multiple declarations of the same interface/namespace, useful for extending library types or global augmentation.

Red flag

Unaware it exists.

How do generics with constraints work?

What a strong answer covers

<T extends U> restricts the type parameter so you can safely access members of U while staying generic.

Red flag

Writes unconstrained generics then casts inside.

What is variance and why does it matter for function types?

What a strong answer covers

Parameters are contravariant and return types covariant in sound reasoning; getting it wrong causes unsafe assignments. They can reason about assignability.

Red flag

No concept of variance; assigns incompatible function types.

How do you keep type-checking fast in a large repo?

What a strong answer covers

Project references, incremental builds, avoiding pathological conditional types, and typing boundaries rather than everything.

Red flag

Lets build times balloon with no strategy.

Skip the screening entirely.We vet TypeScript engineers so you don’t have to — embed one in your team, or have us build it.

Hire TypeScript developersCompare us

Build and score a full interview with our free interview scorecard tool, browse the full question hub, or see how we interview engineers.

Share