TypeScript: Varargs Overload Signatures

Photo by Matt Artz on Unsplash

I thought I’d write up a short post to explain a TypeScript problem that took up far too much of my time.

The TL;DR is that if you have overload signatures for a function that takes a variable number of (initial) arguments, the ordering of the signatures matters in a way that is not obvious. And the ‘simplest’ signature should be placed first.

RxJS core team member; front-end developer; mentor; speaker; open-source contributor

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Anonymous Authentication with Firebase in your Ionic 5 App.

JavaScript Array and String:

Customizing Сreate React App without Eject

The most popular JavaScript Weekly links of 2018

Optional Chaining (But reading this article is not optional…😉)

React with Parcel ?

JavaScript Questions You Might Encounter In An Interview

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nicholas Jamieson

Nicholas Jamieson

RxJS core team member; front-end developer; mentor; speaker; open-source contributor

More from Medium

Typescript dynamic type with any

TypeScript language

A Brief Introductio

Summary of high-level built-in types in TypeScript

typescript