Civet has a feature where, if you declare a function without a body (possibly multiple times for an overload), one of the functions gets an empty body {}.
This feature does the wrong thing in this scenario where one version is exported:
function f(x: number): number
export function f(x: string): string
return x
↓↓↓
function f(x: number): number {}
export function f(x: string): string {
return x;
}
Note the added {}, which means f gets implemented twice.
By contrast, the following is valid TypeScript for an exported function with overloads:
function f(x: number): number
export function f(x: string): string {
return x
}
Civet has a feature where, if you declare a function without a body (possibly multiple times for an overload), one of the functions gets an empty body
{}
.This feature does the wrong thing in this scenario where one version is
export
ed:Note the added
{}
, which meansf
gets implemented twice.By contrast, the following is valid TypeScript for an exported function with overloads: