Skip to main content

Type Signature · #66 · 2026-06-09

Inside the `if` block, what is the type of `s`?

TypeScript ·Difficulty 1/3

How to play

Read the TypeScript snippet and pick the correct type from four choices. Think about inference, narrowing, and utility types. Press 1–4 or click to answer.

type Shape =
  | { kind: 'circle'; radius: number }
  | { kind: 'square'; side: number };
function area(s: Shape) {
  if (s.kind === 'circle') return s;
}

Loading your progress...

Press 1 through 4, or tap a numbered choice, to answer. Back to hub