I have an interface:
export interface EditAction {
action: (p?: Point) => any;
undo(): void;
redo(): void;
complete: () => any;
dispose: () => void;
}
Then there is a concrete class that implements this interface:
export class LineAction implements EditAction {
action(x: number, y: number) {
alert('ok');
}
}
export class PointAction implements EditAction {
action(p: Point) {
alert('ok');
}
}
The method action() in all implementations has different number of parameters.
How to overload it?
action: (p?: Point) => any;
action: (x:number, y: number) => any;
actionin the interface would have no added benefit?action: (input: T) => R.