Ctrl K
Frontend · Junior · Theory

In TypeScript, how is the unknown type different from any?

~4 min by voice

How to approach it

The interviewer checks whether the candidate understands the difference between "turning off typing" (any) and "safely accepting anything" (unknown), can narrow types, and knows where unknown is appropriate in practice.

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, what's the difference between interface and type? 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