Learning Partner

Other Companies (Name Not Shared) React.js Interview Questions for 5-8 years

Shared question set for 5-8 years of experience, TypeScript. Topics and wording follow the supplied notes; these are questions, not official company guidance.

  1. What is the difference between type and interface in TypeScript? When would you choose one over the other? Can an interface be extended or merged?
  2. What is the difference between any, unknown, never and void? When is each appropriate, and why should any generally be avoided?
  3. What are generics in TypeScript? How would you use them to create reusable functions, components, API clients or utility types?
  4. What is type narrowing? How do typeof, instanceof, in, equality checks and custom type guards help TypeScript determine the actual type?
  5. What are union and intersection types? Explain type A = User | Admin versus type B = User & Admin, and when you would use each.
  6. What are type guards, and how would you create a custom type guard (for example, to tell a success response from an error response)?
  7. What are TypeScript utility types? Explain practical use cases for Partial, Required, Pick, Omit, Record, Readonly and ReturnType.
  8. How would you type an API response in a real-world application (generic responses, pagination, errors, optional fields, different response shapes)?
  9. What is the difference between TypeScript compile-time types and runtime validation? If TypeScript says an API response is User, does that guarantee the runtime data is a User?
  10. How would you design a strongly typed large-scale TypeScript application (strict mode, shared types, domain models, API contracts, generics, avoiding any, type-safe error handling)?

Browse React.js question sets