TypeScript interview questions

Types vs interfaces, unknown vs any, generics, narrowing, utility types and why TypeScript doesn’t protect you at runtime.

Readiness: 0 of 12 nailed

How to use this page: 1. Read a question2. Type your answer3. Check with AI4. Open the model answer5. Timed drill when you’re 70% ready

Basics

FoundationConcept

What does TypeScript give you, and what does it *not* do?

JuniorConcept

What is the difference between any and unknown?

JuniorConcept

type vs interface: which do you use?

Mid-levelConcept

What does the satisfies operator do?

JuniorConcept

Enums vs string literal unions?

FoundationConcept

What does strict: true enable, and why turn it on?

Generics

Mid-levelWrite it by hand

Write a typed groupBy function using generics.

JuniorConcept

Name some utility types and when you use them.

SeniorConcept

Explain keyof, indexed access types and mapped types.

Narrowing

Mid-levelConcept

What is a discriminated union, and why is it useful?

Mid-levelConcept

What is the never type used for?

Mid-levelWrite it by hand

Write a custom type guard.

Also prepare