Lead Frontend
​
​
Log inSign up
React interview questionsJavaScript interview questionsTypeScript interview questionsCSS interview questionsHTML interview questionsSenior frontend interview questionsLead frontend engineer interview questionsQuestions by topicCompany guides
© 2026 Lead Frontend. Free educational content, provided as is; it may contain errors. Not affiliated with any company or product named on this site.
TermsPrivacyDisclaimerCopyrightLicenses & credits

TypeScript Interview Questions

40 questions with answers

TypeScript questions show up in almost every modern frontend loop, usually as concept questions about the type system or as part of a coding round. These questions cover generics, narrowing, utility and conditional types, inference and how to type real application code.

How to prepare

  • Explain the difference between type and interface, and between unknown, any and never.
  • Write a small generic function and a custom utility type with conditional and mapped types.
  • Know how narrowing works: type guards, discriminated unions and exhaustive checks.

TypeScript Interview Questions

1.What is the difference between `any`, `unknown` and `never` in TypeScript?

The escape hatch, the safe top type, and the empty bottom type.

Quiz · TypeScript
Easy
6 min

2.What are conditional types and the `infer` keyword in TypeScript?

Type-level branching, pattern matching with infer, and distribution over unions.

Quiz · TypeScript
Hard
9 min

3.What are discriminated unions in TypeScript and how do you enforce exhaustive handling?

Tagged unions that make impossible states unrepresentable, checked with never.

Quiz · TypeScript
Medium
7 min

4.Explain generics and generic constraints in TypeScript

Type parameters that preserve relationships, constraints, defaults, const and NoInfer.

Quiz · TypeScript
Medium
8 min

5.What is the difference between an interface and a type alias in TypeScript?

Declaration merging and extends vs unions, tuples and type-level computation.

Quiz · TypeScript
Easy
6 min

6.Explain `keyof`, `typeof` and indexed access types in TypeScript

Deriving key unions, value types and property types from existing code.

Quiz · TypeScript
Medium
6 min

7.What does the `satisfies` operator do in TypeScript and how is it different from a type annotation or `as`?

Validate against a type while keeping precise inference.

Quiz · TypeScript
Medium
6 min

8.What does `strict` mode enable in TypeScript, and which extra flags are worth turning on?

The strict family, noUncheckedIndexedAccess, exactOptionalPropertyTypes and migration strategy.

Quiz · TypeScript
Medium
7 min

9.What is structural typing in TypeScript and what are its implications?

Compatibility by shape, excess property checks, and when you need nominal types.

Quiz · TypeScript
Easy
6 min

10.What is the difference between a type assertion and a type annotation in TypeScript?

Checking vs overriding the compiler, non-null assertions, and safer alternatives.

Quiz · TypeScript
Easy
6 min

11.How does type narrowing work in TypeScript, and how do you write type guards?

Control-flow narrowing, user-defined and inferred type predicates, and assertion functions.

Quiz · TypeScript
Medium
7 min

12.Do TypeScript types exist at runtime? How do you validate external data?

Type erasure, trust boundaries, schema validation and type stripping.

Quiz · TypeScript
Medium
7 min

13.How do you type event handlers in React with TypeScript?

Synthetic event types, handler aliases, target vs currentTarget, and DOM listener types.

Quiz · TypeScript
Easy
6 min

14.How do you type React component props in TypeScript?

Props types, ReactNode children, native element props, exclusive variants and React.FC.

Quiz · TypeScript
Easy
7 min

15.Which built-in TypeScript utility types do you use most, and how do they work?

Partial, Pick, Omit, Record, ReturnType, Awaited and friends, plus their pitfalls.

Quiz · TypeScript
Easy
7 min

16.What does `as const` do in TypeScript?

Const assertions for literal, readonly types and deriving unions from values.

Quiz · TypeScript
Easy
5 min

17.What are assertion functions in TypeScript?

Functions that narrow by throwing: asserts condition and asserts value is T.

Quiz · TypeScript
Medium
6 min

18.What are branded (nominal) types in TypeScript and why use them?

Phantom brands that stop same-shape values being mixed up and mark validated data.

Quiz · TypeScript
Medium
6 min

19.How do access modifiers work in TypeScript classes, and how is `private` different from `#private`?

Compile-time vs runtime privacy, parameter properties, abstract and override.

Quiz · TypeScript
Medium
6 min

20.What are `.d.ts` declaration files and when do you write them?

Types-only files for JS code, assets and globals, and how packages ship types.

Quiz · TypeScript
Medium
7 min

21.What is declaration merging in TypeScript?

How interfaces, namespaces and enums merge, and how that powers global and module augmentation.

Quiz · TypeScript
Medium
6 min

22.What are distributive conditional types in TypeScript?

How conditional types map over unions, how to disable it, and the never trap.

Quiz · TypeScript
Hard
7 min

23.Should you use enums or union literal types in TypeScript?

Runtime enums vs erasable unions, as const objects, and modern toolchain constraints.

Quiz · TypeScript
Medium
6 min

24.What are excess property checks in TypeScript and when do they apply?

Why fresh object literals reject unknown keys, and when the check doesn't fire.

Quiz · TypeScript
Medium
6 min

25.What are function overloads in TypeScript and when should you use them?

Multiple call signatures with one hidden implementation, and the alternatives.

Quiz · TypeScript
Medium
6 min

26.How do you write generic React components in TypeScript?

Type parameters that connect props, tsx syntax quirks, and wrappers that lose generics.

Quiz · TypeScript
Hard
8 min

27.What are index signatures in TypeScript and what are their pitfalls?

Dictionaries vs exhaustive Records, noUncheckedIndexedAccess, and when to use Map.

Quiz · TypeScript
Medium
6 min

28.What are mapped types in TypeScript and how does key remapping work?

Iterating keys to build types, modifiers, and as-based renaming and filtering.

Quiz · TypeScript
Medium
7 min

29.What is module augmentation in TypeScript and when would you use it?

Extending library and global types with declare module and declare global.

Quiz · TypeScript
Medium
6 min

30.How do you model immutability in TypeScript with `readonly`?

readonly modifiers, Readonly, readonly arrays and as const, and their limits.

Quiz · TypeScript
Medium
6 min

31.What are template literal types in TypeScript and what are they useful for?

Building and parsing string literal types for handlers, routes and typed paths.

Quiz · TypeScript
Hard
7 min

32.What are tuple types in TypeScript, including variadic and labeled tuples?

Fixed-position arrays, optional, rest and labeled elements, and variadic tuple types.

Quiz · TypeScript
Medium
6 min

33.What are type-only imports in TypeScript and what does `verbatimModuleSyntax` do?

Why per-file transpilers need explicit type imports, and the modern tsconfig setup.

Quiz · TypeScript
Medium
6 min

34.How do you type refs in React with TypeScript, and what changed in React 19?

DOM refs, mutable refs, ref as a prop, imperative handles and callback ref cleanups.

Quiz · TypeScript
Medium
7 min

35.How do you type `useReducer` state and actions in TypeScript?

Discriminated-union actions, exhaustive reducers and typed dispatch.

Quiz · TypeScript
Medium
7 min

36.Explain covariance, contravariance and invariance in TypeScript

How generic and function types relate under subtyping, strictFunctionTypes and in/out annotations.

Quiz · TypeScript
Hard
9 min

37.What are `const` type parameters in TypeScript 5.0?

as const-style literal inference without caller ceremony.

Quiz · TypeScript
Medium
5 min

38.How do decorators work in TypeScript, and how do standard decorators differ from experimental ones?

TS 5.0 standard decorators vs legacy experimentalDecorators, and their use cases.

Quiz · TypeScript
Hard
8 min

39.How do you write recursive types in TypeScript, and what are their limits?

Trees, JSON and deep utilities, tail recursion, and compiler performance.

Quiz · TypeScript
Hard
7 min

40.What are `using` declarations (explicit resource management) in TypeScript?

Scope-bound cleanup with Symbol.dispose, await using and DisposableStack.

Quiz · TypeScript
Medium
6 min

More interview questions

React Interview QuestionsJavaScript Interview QuestionsCSS Interview QuestionsHTML Interview QuestionsSenior Frontend Interview QuestionsLead Frontend Engineer Interview QuestionsQuestions by topic