Interview Prep

TypeScript

250 questions across 16 categories

Interview Me →

50 of 50 questions

#CategoryQuestionAnswer★
1Type SystemWhat is the difference between 'type' and 'interface' in TypeScript? When should you prefer one over the other?
Click row to expand
2Type SystemExplain structural typing (duck typing) in TypeScript. How does it differ from nominal typing?
Click row to expand
3GenericsWhat are generic constraints? Explain 'extends', 'keyof', and 'infer' in generic constraints.
Click row to expand
4Utility TypesExplain these built-in utility types and implement each from scratch: Partial, Required, Readonly, Pick, Omit, Record.
Click row to expand
5Type NarrowingExplain TypeScript type narrowing. What are the different narrowing techniques and how does control flow analysis work?
Click row to expand
6Type NarrowingWhat are discriminated unions? How do you use them with exhaustive checks and the never type?
Click row to expand
7Advanced TypesWhat are mapped types? Explain how to use them to create transformation types with modifiers.
Click row to expand
8Advanced TypesWhat are conditional types? Explain distributivity over unions and how to prevent it.
Click row to expand
9Advanced TypesWhat are template literal types? Provide practical examples of type-safe string manipulation.
Click row to expand
10Advanced TypesWhat are recursive types in TypeScript? What are their limitations and how do you handle deeply nested types?
Click row to expand
11GenericsWhat is variance in generic types? Explain covariance, contravariance, and invariance with TypeScript examples.
Click row to expand
12GenericsExplain higher-kinded types simulation in TypeScript using the HKT pattern.
Click row to expand
13GenericsWhat is the Awaited<T> utility type? How do you handle deeply nested Promise types?
Click row to expand
14Advanced TypesHow do you type a tuple type in TypeScript? What are variadic tuple types and how do they enable type-safe currying?
Click row to expand
15DecoratorsWhat are TypeScript decorators? Explain class, method, property, and parameter decorators. What changes in decorators v2 (Stage 3)?
Click row to expand
16ConfigurationExplain the most important tsconfig.json compiler options for strict production TypeScript.
Click row to expand
17Type SystemWhat is the 'unknown' type? How does it differ from 'any', and when should you use it?
Click row to expand
18Type SystemWhat is declaration merging in TypeScript? How is it used for module augmentation?
Click row to expand
19Advanced TypesWhat is satisfies operator (TypeScript 4.9)? How does it differ from type annotation and 'as'?
Click row to expand
20Advanced TypesExplain the Extract and Exclude utility types. How do you use them to manipulate union types?
Click row to expand
21Type SystemWhat is 'as const' assertion? How does it differ from readonly and how does it enable literal type inference?
Click row to expand
22ConfigurationWhat is the TypeScript project references feature? When and how should you use it for monorepo setups?
Click row to expand
23Type SystemWhat are ambient types and .d.ts files? How do you write type declarations for a JavaScript library that has no types?
Click row to expand
24GenericsHow do you implement a type-safe event emitter with generic TypeScript? What pattern enables type-safe event names and payloads?
Click row to expand
25Advanced TypesWhat is the NoInfer utility type (TypeScript 5.4)? What problem does it solve?
Click row to expand
26Type SystemWhat is excess property checking and when does TypeScript bypass it?
Click row to expand
27Advanced TypesHow do you implement a deep merge type in TypeScript? What are the recursive type challenges?
Click row to expand
28ConfigurationWhat are TypeScript path mappings and module resolution? Explain 'node', 'node16', and 'bundler' strategies.
Click row to expand
29Type SystemWhat are opaque/branded types in TypeScript? How do they prevent type confusion between semantically different string or number types?
Click row to expand
30Advanced TypesHow do you use TypeScript with React? Explain typing children, event handlers, generics in components, and forwardRef.
Click row to expand
31Type SystemWhat is the 'infer' keyword in conditional types? Provide three advanced use cases.
Click row to expand
32Advanced TypesHow do you implement a type-safe builder pattern in TypeScript that ensures required fields are set before build() is called?
Click row to expand
33Type SystemWhat is declaration space and how do types and values coexist in TypeScript?
Click row to expand
34GenericsWhat is the ReturnType, InstanceType, and Parameters utility types? How do you use them to derive types from existing code?
Click row to expand
35Advanced TypesHow does TypeScript handle circular type dependencies? What patterns cause infinite recursion and how do you fix them?
Click row to expand
36ConfigurationWhat is isolatedModules in tsconfig and why is it required by tools like Vite and esbuild?
Click row to expand
37Type SystemWhat are assertion functions in TypeScript? How do they differ from type predicates?
Click row to expand
38Advanced TypesWhat is the accessor keyword and private class fields (#)? How do they differ from TypeScript's private keyword?
Click row to expand
39Type SystemHow does TypeScript handle index signatures and Record types? What are the tradeoffs?
Click row to expand
40GenericsWhat is generic inference from default values and from return types? How does TypeScript infer type parameters from usage context?
Click row to expand
41Type SystemWhat are utility types ReturnType, Awaited, and OmitThisParameter? How do they compose for async method typing?
Click row to expand
42Advanced TypesWhat is the 'using' keyword and Symbol.dispose (TypeScript 5.2)? How does it improve resource management?
Click row to expand
43Type SystemHow do you model algebraic data types (ADTs) in TypeScript? Explain product types and sum types.
Click row to expand
44ConfigurationWhat is verbatimModuleSyntax (TypeScript 5.0)? How does it affect import/export behavior?
Click row to expand
45Advanced TypesHow do you type a Redux-like state management system in TypeScript with type-safe actions and reducers?
Click row to expand
46Type SystemWhat is module augmentation vs global augmentation? When would you use each?
Click row to expand
47GenericsWhat is TypeScript's function overloading? When does it help and when does it lead to complexity?
Click row to expand
48ConfigurationWhat is type checking performance? What tsconfig settings and code patterns slow down TypeScript, and how do you fix them?
Click row to expand
49Type SystemHow do you migrate a large JavaScript codebase to TypeScript? What strategy minimizes disruption?
Click row to expand
50Advanced TypesWhat is the difference between unknown, never, any, and void in TypeScript? When is each appropriate?
Click row to expand