Skip to content

Comment on A text adventure game on TypeScript's type system

Comments

This is neat. Can someone explain why the generic types extending string need to default to any in all these cases, like: `TDescription extends string = any` ?

It’s just so I can later reuse that type without having to pass in the generic. Like I do on lines 41 and 42

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.