When you're working with generic types and run into a seemingly unavoidable error, there's a trick that can often make it go away: intersect what you have with whatever TypeScript wants it to be. Your errors will melt away! Read on for examples and caveats.| effectivetypescript.com
This series will present a few tips and tricks for working with TypeScript generics that I've picked up over the past year. This post looks at how you can use classes and currying to combine explicit type parameters and type inference.| effectivetypescript.com
The New TypeScript Handbook has some real gems in it. Here's what it has to say about generics: Writing generic functions is fun, and it can be easy to get carried away with type parameters. Having too many type parameters or using constraints where they aren't needed can make inference less successful, frustrating callers of your function. It goes on to offer a few specific pieces of advice about how to use generics, including one that I've started to think of as the "Golden Rule of Generics...| effectivetypescript.com