← Back to archive

Stdle #102 · narrowing · 2026-09-16

What does this TypeScript snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

function isStr(x: unknown): x is string {
return typeof x === "string"
}
console.log(isStr(42))
Narrowing
4 attempts left

Answer & explanation