Double Space Project

← All entries

Exhibit 142 · Documentation

TypeScript handbook: Generics

TypeScript handbook

Instead of working with any and all types, we’d like to constrain this function to work with any and all types that also have the .length property. As long as the type has this member, we’ll allow it, but it’s required to have at least this member. To do so, we must list our requirement as a constraint on what Type can be.
1 double space marked in red. Copy the quote and you'll get the real spaces too.
Screenshot of TypeScript handbook: Generics, with the double space marked in red.
Open the full-size photo in a new tab.