← Back to archive

Stdle #36 · generics · 2026-07-12

What does this TypeScript snippet output?

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

class Box<T> { constructor(public v: T) {} }
const b = new Box<string>('hi')
console.log(b instanceof Box)
Generics
4 attempts left

Answer & explanation