TypeScript Interview Preparation
Prepare for TypeScript interviews — from fundamentals to advanced type system questions, common patterns, and practical coding challenges.
50 min•By Priygop Team•Last updated: Feb 2026
TypeScript Interview Topics
- Type vs Interface: Both define object shapes. Interface supports declaration merging and extends. Type supports unions, intersections, conditional types, mapped types. Use interface for public APIs, type for complex type operations
- any vs unknown vs never: any disables type checking (avoid). unknown is type-safe any — must narrow before use. never represents values that never occur (exhaustive checking, throw functions). Prefer unknown over any for truly unknown types
- Generics: function identity<T>(value: T): T — functions/classes that work with multiple types while maintaining type safety. Constraints: <T extends HasLength>. Default types: <T = string>. Multiple type parameters: <K, V>
- Utility Types: Partial<T> (all optional), Required<T> (all required), Readonly<T> (immutable), Pick<T, K> (subset), Omit<T, K> (exclude), Record<K, V> (object type), Extract<T, U>/Exclude<T, U> (union manipulation)
- Type Narrowing: typeof, instanceof, 'in' operator, discriminated unions, type predicates (x is Type), assertion functions (asserts x is Type). TypeScript narrows types in control flow branches
- Declaration Files (.d.ts): Type definitions for JavaScript libraries — DefinitelyTyped (@types/react, @types/node). Write custom .d.ts for untyped libraries. declare module for module augmentation