TypeScript Interview Questions 2026
TypeScript interviews test the type system directly. Knowing only basic type annotations is insufficient for senior roles; conditional types and mapped types are tested explicitly.
Type System Fundamentals
Structural typing: TypeScript uses structural subtyping (duck typing) not nominal subtyping. A type is compatible if it has at least the required properties, regardless of how it was declared. This differs from Java/C# and trips up many engineers.
unknown vs any: any opts out of type checking. unknown requires a type guard before use. Prefer unknown for values of unknown type at boundaries (API responses, user input). Avoid any; use it only as a temporary escape hatch with a comment.
Generics
Generics enable type-safe reusable components. Constrained generics: function first<T extends { length: number }>(arr: T[]): T. The constraint limits what T can be while preserving the specific type.
Generic utility types: Partial<T>, Required<T>, Readonly<T>, Pick<T, K>, Omit<T, K>, Record<K, V>, ReturnType<F>, Parameters<F>. Know what each produces and when to use them.
Conditional and Mapped Types
Conditional types: T extends U ? X : Y. Distributive over union types when T is a bare type parameter. Used to implement type-level logic like NonNullable<T>.
Mapped types iterate over keys to produce new types: { [K in keyof T]: T[K] | null }. Combined with conditional types, you can build complex transformations like DeepPartial<T> or DeepReadonly<T>.
Type Guards and Narrowing
typeof, instanceof, and in narrow types in conditional branches. User-defined type guards: function isString(x: unknown): x is string { return typeof x === 'string' }.
Discriminated unions: give each variant a literal type discriminant field. TypeScript narrows the union when you check the discriminant. This is the idiomatic pattern for ADT-style modeling in TypeScript.
Browse Frontend and Full-Stack Questions
Real TypeScript-relevant questions from frontend and full-stack roles.
Browse Meta SWE Questions