Reputation:
My context is React Native / RxJS / TypeScript
I'm trying to subscribe to an event emitter that has 2 parameters.
The function prototype is like this:
handleUpdateValueForDiskStorage = (error: BleError | null, characteristic: Characteristic | null) => {
... }
When I try to subscribe like the following, the code won't compile:
this.emitter = fromEventPattern(this.addHandler, this.removeHandler);
this.rxSubscription = this.emitter.subscribe(this.handleUpdateValueForDiskStorage);
The error is: Argument of type '(error: BleError | null, characteristic: Characteristic | null) => void' is not assignable to parameter of type '(value: any) => void'.
However it seems that I can only have one argument coming from the event.
I've done some research and found this. This is about projecting the 2 arguments into an array.
I don't know if this is still valid and can't seem to wrap my head around it to do the same.
Upvotes: 0
Views: 195