Open TheOd1n opened 1 year ago
There are several bugs in the library. The Promise.reject(...)
parts in bluetooth.service.ts
line 162, 255 and 264 must be returned. In the else branch of line 165 a Promise.reject(...)
must also be returned. I use the following hot fix:
private readonly fixMap = <T>(t: T | void) => {
if (!t) {
throw new Error();
}
return t;
};
private readonly device$ = this.bluetooth
.discover$({
optionalServices: [this.serviceUuid],
filters: [{ services: [this.globalServiceUuid] }],
})
.pipe(
// Hot fix for bug in bluetooth core
map(this.fixMap),
mergeMap(server =>
this.bluetooth.getPrimaryService$(server, this.serviceUuid)
),
mergeMap(service =>
this.bluetooth.getCharacteristic$(service, this.characteristicUuid)
),
// Hot fix for bug in bluetooth core
map(this.fixMap)
);
@manekinekko you should enable strict mode to avoid such mistakes. Best greetings :)
Example 2.b) generates the following error message when copied to the Angular project: