AI Hints
Home›TypeScript Tutorial›Cheat Sheets and Interviews
TypeScript · Lesson 117 of 120

TypeScript Interview Questions

Ten to know.

⏱ 2 min read▶ Video at 1:32:36🎓 Free
Watch this lesson in the TypeScript courseWatch on YouTube ↗Full TypeScript course

TypeScript questions come up in almost every web developer interview. Here are ten, with short answers. Pause and answer each one first.

TypeScript Interview Questions
From the video: TypeScript Interview Questions
  • Ten questions
  • Short answers
  • Answer first

Questions one to five

What is TypeScript? JavaScript with static types, compiled to JavaScript. Type or interface? Both describe objects, aliases also do unions. Any versus unknown? Unknown forces a check. What is narrowing? Checking a type to get a more specific one. What are generics? Type parameters for reusable code.

QuestionShort answer
What is TypeScript?typed JavaScript, compiled to JS
type vs interface?both for objects; type for unions
any vs unknown?unknown forces a check
Narrowing?checks give specific types
Generics?reusable type parameters

Questions six to ten

What's a discriminated union? Shapes sharing a literal kind field. What does keyof do? Gives property names as a union. Name some utility types? Partial, Pick, Omit, and Record. Do types exist at runtime? No, they're erased. And what does strict do? Turns on the safety checks.

QuestionShort answer
Discriminated union?shapes with a kind field
keyof?property names as a union
Utility types?Partial, Pick, Omit, Record
Types at runtime?no, they're erased
strict?turns on safety checks

Summary

Ten questions, ten short answers. Know these, and most TypeScript interviews feel easy. Next, the TypeScript ecosystem.

Key takeaways
  • unknown
  • Narrowing
  • Erased types
Next up: The TypeScript Ecosystem — frameworks and tools