TypeScript — Interview questions
Advanced Types
The type-level programming layer — conditional types and infer, mapped types over keyof, template literal types, distributive conditionals, and recursive types with their instantiation-depth limits.
16 questions
Async & Promises
Typing asynchronous code — callback signatures versus Promise<T>, how async/await infers return types, Awaited<T>, Promise.all over heterogeneous promises, and async generators.
7 questions
Build & Toolchain
Type-checking with tsc versus transpiling with esbuild or SWC, the Go-native TypeScript 7 compiler, project references and incremental builds in a monorepo, typescript-eslint, and diagnosing slow type-checking.
18 questions
Class Patterns
Classes beyond the basics — implements versus extends, why two same-shape classes are assignable, the polymorphic this type, mixins, method overriding under structural typing, and fluent builders that encode call order in their types.
10 questions
Classes
Class members and accessors, access modifiers, parameter properties, inheritance, and abstract classes.
12 questions
Decorators
Declarative annotations that wrap classes and their members to add or change behavior.
2 questions
Functions
Typing functions, parameters and return values, optional/default/rest parameters, and function overloads.
6 questions
Fundamentals
What TypeScript is and how it relates to JavaScript, variable declaration, const versus let, and type inference.
8 questions
Generics
Type parameters for reusable type-safe code, generic constraints with extends, and the standard utility types built on them.
12 questions
Interfaces & Types
Interfaces as structural contracts, interface versus type alias, structural typing, and declaration merging.
13 questions
JavaScript Interop
Living with untyped JavaScript — JSDoc types and @ts-check in .js files, libraries with no @types, declaring globals added by a script tag, typing Proxy-based APIs, and prototype-based code that predates classes.
8 questions
Migration & Adoption
Bringing TypeScript into an existing codebase — gradual file-by-file adoption, @ts-expect-error versus @ts-ignore, rolling out strictNullChecks on a large project, enforcing conventions in CI, and reviewing a PR full of any.
6 questions
Modules & Resolution
ES modules versus CommonJS emit, module resolution strategies (node16, bundler), import type and isolatedModules, namespaces, module augmentation, dynamic import, and @types packages.
13 questions
Narrowing & Type Guards
How control flow narrows a union down to one member — typeof and instanceof checks, the in operator, discriminated unions, user-defined type guards, assertion functions, and never-based exhaustiveness.
12 questions
Type-Safe Patterns
Applied designs that push checks to compile time — key-to-payload type registries, typed event emitters and WebSocket protocols, a fetch wrapper that infers by endpoint, plugin systems, generic repositories, typed Express middleware chains, and process.env.
12 questions
React & TypeScript
Typing a React codebase — component props and why React.FC fell out of favour, useState with a null initial value, custom hooks that return tuples, discriminated prop unions for component variants, reducers, and form-error shapes.
10 questions
Runtime Validation
Where the type system stops and runtime checks begin — why TypeScript cannot trust an API response, schema validators like Zod and the types inferred from them, OpenAPI and GraphQL codegen, contract tests, and keeping generated types from drifting.
8 questions
Testing & Type Tests
Testing a typed codebase — type-checking test files, type-safe mocks and fixtures, alternatives to as any, asserting that a call is rejected at compile time with tsd or expect-type, and typing a custom Jest matcher.
6 questions
Tooling & Compiler
Compiling TypeScript to JavaScript with tsc, tsconfig.json configuration, and strict-mode compiler options.
11 questions
Type System
What TypeScript's types actually are — compile-time erasure, assertions versus satisfies, as const, branded types that simulate nominal typing, how any poisons inference, and where the type system is deliberately unsound.
13 questions
Types
Basic and primitive types, tuples, the any/unknown/never special types, and enums.
15 questions