Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumTypeScriptgeneric constraintsSingle-choice MCQ

Why is the call `wrap(42)` rejected here?

function wrap<T extends { length: number }>(x: T): T[] { return [x]; } wrap("hello"); wrap([1, 2, 3]); wrap(42);