What could be causing this error?
I am attempting to overload with typescript but despite reading the documentation, I am unable to pinpoint the error. Can someone offer some assistance?
export declare type TCallbackResponse<T> = ICallbackResponse<T>;
export type ICallbackResponse<T = string> = {
(arg1: T, arg2: T, arg3: T): Promise<void>;
(arg1: T, arg2: T): Promise<void>;
}
function handle<T = string>(name: string, call: ICallbackResponse<T>): void {
}
async function message(pattern: string, channel: string, message: string): Promise<void>
async function message(channel: string, message: string): Promise<void> {
}
async function pmessage(pattern: string, channel: string, message: string): Promise<void> {
}
handle('message', message) // Argument of type '(pattern: string, channel: string, message: string) => Promise<void>' is not assignable to parameter of type 'ICallbackResponse<string>'.(2345)
handle('message', pmessage) // Argument of type '(pattern: string, channel: string, message: string) => Promise<void>' is not assignable to parameter of type 'ICallbackResponse<string>'.(2345)
Check out the code here: here