- Error
- Reported by the type checker
TS2389
Function implementation name must be '{0}'.
The implementation after a group of overload signatures has a different name. Rename it to match the overloads, or add the missing implementation.
What it means
Overload signatures must be followed directly by the implementation with the same name. When the next function declaration has another name, it can't implement the overloads.
Example
export function format(value: number): string;
export function formatValue(value: number): string {
return value.toFixed(2);
}
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(2,17): error TS2389: Function implementation name must be 'format'.
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.
How to fix
- Give the implementation the same name as the overload signatures.
- If the overload was meant to be a separate function, give it a body.