In this code declaring several overloading functions:
export function rect(a: Point, b: Point): Rect;
export function rect(a: Point, b: number|Point, c?: number): Rect;
export function rect(a: number|Point, b: number|Point, c?: number, d?: number ) {return new Rect(a,b,c,d);}
rect( 1,1,1, 1) // ts: "Expected 2-3 arguments, but got 4.ts(2554)"
Typescript complains in the 4th arg. I couldn't figure what is wrong here. If I add one more overload with one more arg:
export function rect(a: Point, b: Point): Rect;
export function rect(a: Point, b: number|Point, c?: number): Rect;
export function rect(a: number|Point, b: number|Point, c?: number, d?: number ): Rect ;
export function rect(a: number|Point, b: number|Point, c?: number, d?: number, e?: number ): Rect {return new Rect(a,b,c,d);}
rect( 1,1,1, 1)
ts does NOT complain (it gives the same error if I add the 5th arg to the call to rect)
What's wrong?