Quick Answer

Call doesn't match any overload signature

Understanding the Issue

When using function overloads, the actual call must match one of the declared signatures. This error occurs when arguments don't match any overload.

The Problem

This code demonstrates the issue:

Typescript Error
// Problem: Invalid call
function createDate(timestamp: number): Date;
function createDate(y: number, m: number, d: number): Date;
function createDate(): Date {
    // Implementation
}

createDate("2020-01-01"); // Error

The Solution

Here's the corrected code:

Typescript Fixed
// Solution 1: Match an overload
createDate(1609459200000); // Timestamp
createDate(2020, 0, 1); // Y,M,D

// Solution 2: Add new overload
function createDate(dateString: string): Date;

// Solution 3: Use union parameters
function createDate(...args: number[] | [string]): Date;

Key Takeaways

Ensure function calls match declared overload signatures or add new overloads.