TypeScript has become the default for frontend and increasingly backend development at Indian product companies in 2026. Razorpay, PhonePe, Flipkart, and most tech-forward Indian startups now write TypeScript by default. This guide covers the TypeScript interview questions you will encounter at these companies: from type fundamentals to generics and the practical patterns that distinguish strong TypeScript engineers.
TypeScript Basics: What Every Interview Tests
TypeScript is a superset of JavaScript that adds static typing. Every valid JavaScript is valid TypeScript, but TypeScript adds type annotations that are checked at compile time and stripped at runtime. The core value proposition: catching type errors at development time rather than at runtime. Basic types: string, number, boolean, null, undefined, void (for functions returning nothing), never (for functions that never return: throw or infinite loop), any (escape hatch: avoid in production code), unknown (type-safe alternative to any: must narrow before use). Primitive literals: 'red' | 'green' | 'blue' is a union of string literals: more precise than just string. The difference between null and undefined: null is explicitly 'no value', undefined is 'not assigned'. TypeScript's strictNullChecks (part of strict mode) prevents assigning null to a variable typed as string unless explicitly allowed with string | null.
Type vs Interface: The Most Common Interview Question
The type vs interface question appears in nearly every TypeScript interview. Both define object shapes. Key differences: Interfaces can be extended with extends and can be merged (declaration merging: two interface declarations with the same name merge their properties). Types use intersection (&) for composition and cannot be merged. Types are more flexible: they can represent union types (A | B), intersection types (A & B), mapped types, and conditional types: things interfaces cannot express. Interface: best for defining the shape of objects and class contracts (implements), especially when you want extendability and declaration merging. Type: best for unions, intersections, computed/mapped types, and aliases for primitives. The honest answer in an interview: 'I prefer interface for objects and type for everything else, unless I need a union or computed type.' Both are acceptable in most codebases.
Generics: The Depth Question
Generics allow writing reusable code that works across types. The classic example: function identity<T>(arg: T): T { return arg; }: the function accepts any type and returns that same type, preserving type information. Where generics shine: utility functions (pick, omit, filter), data structures (Stack<T>, Queue<T>), API response wrappers (ApiResponse<T extends object>), and React component props. Constraints: function longest<T extends { length: number }>(a: T, b: T): T: T must have a length property. Multiple type parameters: function zip<A, B>(a: A[], b: B[]): [A, B][]: pairs elements from two arrays. Generic interfaces: interface Repository<T> { findById(id: string): Promise<T>; save(entity: T): Promise<T>; }: the Repository pattern typed generically. Common interview question: 'Write a generic function that extracts a specific property from an array of objects': uses keyof T constraint.
TypeScript interviews test how you reason about types under pressure. Practise explaining your type decisions out loud with HireStepX before your frontend interview.
Practice freeUtility Types Every TypeScript Engineer Should Know
TypeScript's built-in utility types are heavily tested. Partial<T>: makes all properties of T optional. Required<T>: makes all properties required. Readonly<T>: makes all properties read-only (prevents mutation). Pick<T, K>: creates a type with only the specified keys from T. Omit<T, K>: creates a type excluding the specified keys. Record<K, V>: creates an object type with keys of type K and values of type V. ReturnType<T>: extracts the return type of a function type. Parameters<T>: extracts the parameter types of a function as a tuple. NonNullable<T>: removes null and undefined from T. Awaited<T>: unwraps the type of a Promise. The practical interview question: 'How would you create a type for a form that makes all fields optional for a partial update (PATCH) request?': answer: Partial<FormSchema>.
TypeScript in Practice: What Indian Companies Care About
Beyond syntax, Indian product company interviews test practical TypeScript judgment. Strict mode: always enable strict in tsconfig.json (strictNullChecks, noImplicitAny, strictFunctionTypes). Non-strict TypeScript is only marginally better than JavaScript. Type narrowing: using typeof, instanceof, 'key' in obj, and custom type guards (function isCat(animal: Animal): animal is Cat) to narrow union types. Discriminated unions: a pattern for exhaustive type checking: each union member has a unique literal 'kind' or 'type' field that TypeScript uses to narrow. Type assertion vs type casting: as SomeType is an assertion (you are telling TypeScript you know better); use only when you have information the compiler doesn't. Avoid as any and as unknown as T: they silence the type system entirely. Declaration files (.d.ts): how to type third-party libraries that don't include TypeScript definitions.
Frequently asked questions
Practice these questions on HireStepX