When trying to pass a function with callback to the rxjs bindCallback
function, I encountered an issue with my generic type.
Here is the code snippet in question:
const obCreator = bindCallback<T>(FakeServer.instance.on<T>);
return obCreator(module, method);
The error occurs in the first line:
An overload does not match this call. Overload 1 of 34, '(callbackFunc: (callback: (res1: T) => any) => any, scheduler?: SchedulerLike | undefined): () => Observable', has given the following error. Argument of type 'void' is not assignable to parameter of type '(callback: (res1: T) => any) => any'.
The below code has no error but lacks generics:
const obCreator = bindCallback(FakeServer.instance.on);
return obCreator(module, method);