TypeScript Interview Questions: From Junior to Architect

TypeScript has become the standard language for building scalable JavaScript applications, but mastering it requires far more than understanding basic types and interfaces. This flashcard set contains a comprehensive collection of TypeScript interview questions covering the entire spectrum of knowledge—from core language fundamentals to advanced architectural decision-making. You'll explore type inference, unions, intersections, generics, utility types, conditional types, template literal types, type guards, discriminated unions, and type-level programming. The collection also covers practical engineering topics such as React integration, backend application design, API contracts, runtime validation, database modeling, event-driven systems, microservices, GraphQL, SDK design, and Domain-Driven Design (DDD). Beyond implementation details, the cards focus on real-world trade-offs, architectural decisions, scalability concerns, maintainability challenges, and enterprise-level best practices. Whether you're preparing for a TypeScript developer interview, advancing toward a senior engineer position, designing large-scale systems, or building a deeper understanding of modern application architecture, these flashcards provide structured and practical learning material. Ideal for: - Frontend developers using React and Next.js - Backend developers working with Node.js and NestJS - Full-stack engineers - Technical leads and architects - Developers preparing for middle, senior, staff, or architect-level interviews - Teams adopting TypeScript in large-scale applications Learn not only how TypeScript works, but also when to use specific patterns, what trade-offs they introduce, and how they impact long-term maintainability and system design.

You can take a test to reveal missed lore before start a training.

Test Your Might

You can start studying this pack. You'll receive 432 messages to help you review each card multiple times, following the principles of the forgetting curve.

Learn more about the spaced repetition method.
TypeScript

What is TypeScript: TypeScript is a statically typed superset of JavaScript that adds optional types, advanced tooling and compile-time checks. It compiles to plain JavaScript so it runs anywhere JavaScript runs.

1/108
TypeScript type system: how it works, compile-time guarantees and runtime limits

How does TypeScript's type system work, what guarantees it gives at compile time, and what limitations arise because types do not exist at runtime?

2/108
Type inference in TypeScript

What is type inference in TypeScript?

3/108
Type annotations

What are type annotations, including their impact on readability, maintainability, and long-term code evolution?

4/108
TypeScript primitive types

Summary of TypeScript primitive types, their runtime JavaScript counterparts, and constraints they impose on application design.

5/108
Literal types (string, number, boolean)

What are literal types (string, number, boolean) and how they help improve type safety in production?

6/108
Union types (TypeScript)

What are union types, how to narrow them, common use cases, and what limits appear as unions become larger and more complex?

7/108
Intersection types

What intersection types are and how they behave when composing types, modeling objects and combining incompatible structures.

8/108
Type vs Interface (TypeScript)

What is the difference between type and interface in TypeScript, including extensibility, declaration merging, and architectural trade-offs?

9/108
const assertions (literal preservation, readonly inference, API use)

What are const assertions, including literal preservation, readonly inference, and practical use cases in API design?

10/108
readonly modifier (TypeScript)

What is the readonly modifier?

11/108
unknown, any, never (TypeScript types)

What are unknown, any, and never; their intended purposes, safety implications, and common misuse patterns?

12/108
Structural typing

What is structural typing, including compatibility rules, benefits for flexibility, and potential risks in large codebases?

13/108
Declaration merging

What is declaration merging, including how it works, practical applications, and the maintenance challenges it can introduce?

14/108
TypeScript enums

What enums are in TypeScript and how they behave at runtime, alternatives, and common problems when using them in modern apps.

15/108
User-defined type guards

What are user-defined type guards, including predicate functions, reuse strategies, and limitations when modeling complex domains?

16/108
Built-in type guards: typeof, instanceof, in

Short: Built-in type guards (typeof, instanceof, in) are runtime checks that let TypeScript narrow union types inside branches so you get safe completions and avoid casts.

17/108
TypeScript: type narrowing, control-flow analysis, and branch behavior

How does type narrowing work in TypeScript, including control flow analysis, type guards, and compiler behavior during branch evaluation?

18/108
Discriminated unions (exhaustive checks, domain modeling, trade-offs)

What are discriminated unions, how exhaustive checks work, why they help with domain modeling, and what trade-offs exist compared to inheritance-based designs?

19/108
Excess property checks (TypeScript)

What are excess property checks in TypeScript?

20/108
TypeScript control flow analysis

Overview: TypeScript uses control flow analysis (flow-sensitive typing) to track how values change through code paths and to narrow union types based on runtime checks. This analysis reduces many runtime errors by letting the compiler reason about which subtype is valid at a particular point in the program.

21/108
TypeScript assignability & compatibility

How does TypeScript perform assignability checks, including compatibility rules, variance concepts, and edge cases developers should understand?

22/108
Type erasure (TypeScript)

What is type erasure, including how TypeScript removes types during compilation and what architectural consequences this creates?

23/108
TypeScript: recursive type evaluation

How does TypeScript handle recursive type evaluation, including compiler limits and performance implications?

24/108
TypeScript: overload resolution

How does TypeScript resolve overloaded function signatures, including overload selection rules and common pitfalls?

25/108
Generics

What are generics, including their role in reusable abstractions, type safety improvements, and practical applications in large systems?

26/108
Generic constraints (extends): how they work, API design, and limitations

How do generic constraints work, including the extends keyword, API design considerations, and limitations they introduce?

27/108
Generic interfaces — reusable contracts & enterprise patterns

How do generic interfaces work, including reusable contracts and common patterns used in enterprise applications?

28/108
Generic defaults: benefits and trade-offs

What are generic defaults, including how they improve usability and the trade-offs between flexibility and simplicity?

29/108
Generic functions

How do generic functions work, including inference behavior, constraint enforcement, and reusable utility design?

30/108
Generic classes: how they work, state management, DI scenarios, and architectural benefits

How do generic classes work, including state management, dependency injection scenarios, and architectural benefits?

31/108
Conditional types

What are conditional types, including type-level branching, practical applications, and compiler complexity considerations?

32/108
Mapped types (TypeScript)

What are mapped types in TypeScript, how can you transform properties, where they are useful, and what limitations exist when modeling complex structures?

33/108
Deeply nested generics — challenges

What challenges arise when generics become deeply nested, including readability, maintainability, and compilation performance concerns?

34/108
TypeScript utility types: Partial, Required, Readonly, Pick

How do utility types such as Partial, Required, Readonly, and Pick work, including their internal implementation and common production use cases?

35/108
Distributive conditional types

What are distributive conditional types, how distribution happens across unions, and which surprising behaviors to watch for.

36/108
infer keyword (TypeScript)

How does the infer keyword work in TypeScript? Short overview, common extraction techniques and advanced utility type patterns using infer.

37/108
TypeScript utility types: Partial, Required, Readonly, Pick

How do Partial, Required, Readonly and Pick work, what are their internal implementations and common production use cases?

38/108
Template literal types

What are template literal types, including dynamic string generation, practical use cases, and limitations in large-scale systems?

39/108
Utility types: Omit, Exclude, Extract, NonNullable

How do TypeScript utility types Omit, Exclude, Extract and NonNullable work, and how are they used in API and domain modeling?

40/108
keyof operator (TypeScript)

A concise guide to the keyof operator: how it extracts keys from types, how to use it in generics and mapped types, and how it helps build type-safe APIs.

41/108
Indexed access types and cross-model consistency

What are indexed access types, including property extraction strategies and maintaining consistency across domain models?

42/108
DeepPartial and DeepReadonly (TypeScript)

How to implement DeepPartial and DeepReadonly, what recursion pitfalls exist, and what performance trade-offs to consider?

43/108
Recursive types and tree-like structures

Summary: Recursive types let a type refer to itself, enabling representation of nested or tree-like data such as ASTs, file systems, or UI component trees. Compilers impose expansion limits; practical modeling uses patterns like nullable children, discriminated unions, or indirection via IDs to manage complexity.

44/108
Branded types (nominal-typing simulation)

What are branded types, including nominal typing simulation, domain safety improvements, and implementation approaches?

45/108
Type-level programming to reduce runtime errors

How can type-level programming reduce runtime errors, including practical examples and the trade-offs in developer productivity?

46/108
Risks of excessive type-level programming

What are the risks of excessive type-level programming, including cognitive complexity, onboarding challenges, and slower compilation times?

47/108
TypeScript and domain invariants

How can TypeScript be used to enforce domain invariants, including compile-time guarantees and limitations that require runtime validation?

48/108
Advanced type composition for API ergonomics

How can advanced type composition improve API ergonomics, including fluent interfaces, builders, and DSL-style libraries?

49/108
Variadic tuple types (TypeScript)

How do variadic tuple types work, including tuple manipulation, generic flexibility, and real-world applications?

50/108
Function overloading

What is function overloading, including implementation strategies, practical use cases, and maintenance trade-offs?

51/108
Typing asynchronous code (Promises, async/await, propagation)

How should asynchronous code be typed, including Promises, async/await, and propagation of typed results?

52/108
Typing functions in TypeScript

How to type functions in TypeScript: parameter definitions, return types, and API design considerations.

53/108
Typing callback-based APIs in TypeScript

How should callback-based APIs be typed, including generic callbacks, error handling, and reusability concerns?

54/108
TypeScript: modeling finite state machines

How can TypeScript model finite state machines, including state transitions, compile-time guarantees, and maintainability considerations?

55/108
Asynchronous error handling: design & production concerns

How should asynchronous error handling be designed, including unknown exceptions, error modeling, and production reliability concerns?

56/108
TypeScript for safer API clients

How TypeScript improves safety of API clients: request modeling, response typing, and handling invalid server responses.

57/108
Why compile-time types are insufficient for external data

Why is compile-time type safety insufficient for external data, including API boundaries, user input, and serialization concerns?

58/108
Typing event-driven systems

How should event-driven systems be typed, including event contracts, payload consistency, and evolution of event schemas over time?

59/108
Runtime validation: implementation, libraries, performance and DX

How to implement runtime validation: which libraries to consider, performance optimizations, and developer-experience trade-offs.

60/108
Environment variables — typing, validation, risks and config management

How should environment variables be typed, including validation strategies, deployment risks, and configuration management concerns?

61/108
Typing database models: entities, repositories, and schema evolution

How should database models be typed, including entity definitions, repository patterns, and schema evolution challenges?

62/108
TypeScript + Zod: schema inference, validation workflows, and syncing runtime/compile-time contracts

Summary: Zod is a TypeScript-first runtime schema validation library. You declare schemas with Zod and derive TypeScript types with z.infer, keeping runtime checks and compile-time types synchronized. Typical workflows include synchronous parsing, safe parsing, async refinements, middleware validation, and schema composition for shared contracts.

63/108
Modeling external third-party APIs

How should external third-party APIs be modeled, including incomplete documentation, unreliable responses, and long-term maintenance concerns?

64/108
TypeScript + io-ts

How can TypeScript be integrated with io-ts, including functional validation patterns and architectural implications?

65/108
Typing React hooks

How should React hooks be typed, including custom hooks, reusable abstractions, and maintainability concerns?

66/108
React + TypeScript: structure, contracts, state, scalability

How should React applications be structured using TypeScript, including component contracts, state modeling, and scalability considerations?

67/108
Modeling form data in TypeScript

How to model form data in TypeScript: types, validation workflows, nested structures, and developer-productivity patterns.

68/108
Dependency injection with TypeScript

How should dependency injection frameworks be used with TypeScript, including type safety guarantees and architectural implications?

69/108
Typing global state (Redux, Zustand, Context)

How should global state management be typed, including Redux, Zustand, or Context API, and what trade-offs arise between approaches?

70/108
Typing design system components: APIs, extensibility, and consumer experience

How should design system components be typed, including reusable APIs, extensibility requirements, and consumer experience?

71/108
Domain models in TypeScript

How to represent domain models in TypeScript: entities, value objects and aggregate boundaries — pragmatic guidance and examples.

72/108
Typed routing for large applications

How should routing be typed, including route parameters, navigation safety, and maintainability in large applications?

73/108
TypeScript in backend: service boundaries, DTOs, and domain modeling

How should TypeScript be used in backend applications, including service boundaries, DTOs, and business logic modeling?

74/108
Repository pattern in TypeScript

How should repository patterns be implemented in TypeScript, including abstraction boundaries and persistence concerns?

75/108
Typing background jobs and queues

How to type background jobs and queues: define clear payload contracts, enforce validation, make retry behavior explicit, and plan for schema evolution.

76/108
Microservice contracts: typing, boundaries, versioning, compatibility

How should microservice contracts be typed, including service boundaries, versioning strategies, and backward compatibility concerns?

77/108
Declaration files (.d.ts): creation, distribution and third-party integration

How should declaration files be created and maintained, including package distribution and third-party integration concerns?

78/108
Designing public TypeScript libraries

How should public TypeScript libraries be designed, including API ergonomics, backward compatibility, and consumer experience?

79/108
TypeScript compilation performance

What factors affect TypeScript compilation performance, including project size, type complexity, and build configuration choices?

80/108
Project references — incremental compilation, monorepo support, scalability

How project references work in TypeScript: an overview of incremental builds, monorepo usage and scalability benefits.

81/108
Typing SDKs: API contracts, versioning, long-term evolution

How should SDKs be typed, including API contracts, versioning strategies, and support for long-term evolution?

82/108
Public generic APIs — common mistakes

What mistakes commonly occur when exposing public generic APIs, including overengineering, breaking changes, and usability problems?

83/108
Fluent APIs in TypeScript

How should fluent APIs be designed in TypeScript, including chaining, type inference, and maintainability trade-offs?

84/108
Danger of excessive type assertions

Why can excessive type assertions become dangerous, including false guarantees and runtime failure scenarios?

85/108
Type safety vs developer productivity

What trade-offs exist between strict type safety and developer productivity, including team velocity and maintenance costs?

86/108
Why excessive use of any is an anti-pattern

Why is excessive use of any considered an anti-pattern, including hidden risks, debugging challenges, and long-term maintenance costs?

87/108
Performance issues from advanced type-level programming

What performance issues can arise from advanced type-level programming, including IDE responsiveness and compiler throughput limitations?

88/108
Problems of coupling domain models to transport models

What issues arise when domain models are tightly coupled to transport models (e.g. HTTP/JSON payloads, DB rows, or RPC schemas)?

89/108
Risks of duplicating types across application layers

What risks arise from duplicating types across application layers, including consistency issues and synchronization costs?

90/108
Optimizing TypeScript builds

How should TypeScript builds be optimized, including compiler configuration, caching strategies, and CI/CD integration?

91/108
Pitfalls of overusing inheritance in TypeScript

What problems arise from overusing inheritance in TypeScript, including coupling concerns and alternatives based on composition?

92/108
Overly complex generic abstractions

What problems occur when generic abstractions become overly complex, including readability concerns and onboarding difficulties?

93/108
Type-system over-engineering indicators

What indicators suggest that a codebase is over-engineered from a type-system perspective, including maintainability and productivity impacts?

94/108
Managing shared contracts across frontend, backend and microservices

How should shared contracts be managed across frontend, backend, and microservices, including versioning strategies, ownership models, and scalability concerns?

95/108
Designing a type-safe distributed architecture

How to design a type-safe distributed architecture: service communication, event contracts, and schema evolution challenges.

96/108
Type-safe distributed architecture

How should a type-safe distributed architecture be designed, including service communication, event contracts, and schema evolution challenges?

97/108
TypeScript in Domain-Driven Design

How should TypeScript be used in a Domain-Driven Design architecture, including bounded contexts, domain isolation, and long-term maintainability?

98/108
API versioning in TypeScript ecosystems

How should API versioning be handled in TypeScript-based ecosystems, including backward compatibility, migration strategies, and consumer impact?

99/108
TypeScript in Domain-Driven Design

How should TypeScript be used in a Domain-Driven Design architecture, including bounded contexts, domain isolation, and long-term maintainability?

100/108
Modeling event-driven architectures in TypeScript

How to model event-driven architectures in TypeScript covering event versioning, contract evolution, and failure recovery considerations.

101/108
Syncing GraphQL schemas and TypeScript types

How should GraphQL schemas and TypeScript types be synchronized, including code generation workflows and maintenance trade-offs?

102/108
Company-wide type platform

A company-wide type platform centralizes TypeScript types and related utilities so teams share a common contract, reduce duplication and speed integrations. This card summarizes structure, governance and dependency practices.

103/108
Company-wide type platform

How should a company-wide type platform be organized, including shared packages, governance models, and dependency management?

104/108
Large-scale migration: JavaScript → TypeScript

How should large-scale migrations from JavaScript to TypeScript be planned, including risk management, rollout strategies, and organizational challenges?

105/108
When to choose TypeScript

When is TypeScript the right architectural choice, and when might its complexity outweigh its benefits—taking into account team expertise, project requirements, and long-term maintenance costs?

106/108
TypeScript at enterprise scale — limitations

What limitations of TypeScript become significant at enterprise scale, including compiler performance, type complexity, and team coordination issues?

107/108
Organizing large TypeScript monorepos

How should large TypeScript monorepos be organized, including shared types, dependency management, and build optimization strategies?

108/108
WitSlice © 2026