TypeScript lets one function accept different arguments and return different types depending on how you call it. The syntax looks simple, but the rules about which signature wins and what callers actually see trip up almost everyone the first time.
👉 Continue reading on my blog: 🔀 TypeScript function overloading
Top comments (1)
Nice - I didn't know about that!
I neatened up your example a little: diffchecker.com/FuL9OkcM