Ctrl K
Frontend · Junior · Theory

In TypeScript, what's the difference between interface and type?

~4 min by voice

How to approach it

The interviewer wants to see whether you understand that interface and type are almost interchangeable for objects, and whether you know the real differences: what type can do (unions, primitives, tuples, mapped/conditional types) and the features of interface (declaration merging, extends). Plus whether you have a deliberate rule for choosing.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsYou join a large TypeScript project with lots of any and strict turned off. How would you go about tightening the typing, and which type-level decisions do you consider key for maintainability? SeniorIn TypeScript, how is the unknown type different from any? JuniorWhen do you use unknown instead of any in TypeScript, and how do you work with such a value afterwards? Mid-level

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min