LearningTypeScript / site

Companion website for the Learning TypeScript book.
https://learningtypescript.com
MIT License
47 stars 11 forks source link

Article: Narrowing Function Parameters With Rests And Tuples #116

Closed JoshuaKGoldberg closed 9 months ago

JoshuaKGoldberg commented 10 months ago

I've seen this come up once in a while: that there are several strategies for declaring functions that may be called in multiple different ways. This article goes over three of the most reasonable ways:

  1. Function overloads
  2. Generic functions
  3. Destructured rest parameters of a tuple type