From 2c08e8b3ee7ce010331a1256a63c725dae45273c Mon Sep 17 00:00:00 2001 From: Nathan Kellenicki Date: Thu, 25 Apr 2019 21:57:16 -0700 Subject: [PATCH] Fixed typescript errors --- src/duplotrainbase.ts | 2 +- src/lpf2hub.ts | 2 +- src/pupremote.ts | 2 +- src/wedo2smarthub.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/duplotrainbase.ts b/src/duplotrainbase.ts index ac7ab21..4a24824 100644 --- a/src/duplotrainbase.ts +++ b/src/duplotrainbase.ts @@ -94,7 +94,7 @@ export class DuploTrainBase extends LPF2Hub { */ public setLEDColor (color: number | boolean) { return new Promise((resolve, reject) => { - if (color === false) { + if (typeof color === "boolean") { color = 0; } const data = Buffer.from([0x81, 0x11, 0x11, 0x51, 0x00, color]); diff --git a/src/lpf2hub.ts b/src/lpf2hub.ts index 040583f..dc16c07 100644 --- a/src/lpf2hub.ts +++ b/src/lpf2hub.ts @@ -89,7 +89,7 @@ export class LPF2Hub extends Hub { return new Promise((resolve, reject) => { let data = Buffer.from([0x41, 0x32, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]); this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, data); - if (color === false) { + if (typeof color === "boolean") { color = 0; } data = Buffer.from([0x81, 0x32, 0x11, 0x51, 0x00, color]); diff --git a/src/pupremote.ts b/src/pupremote.ts index b4858f4..dfaba58 100644 --- a/src/pupremote.ts +++ b/src/pupremote.ts @@ -95,7 +95,7 @@ export class PUPRemote extends LPF2Hub { return new Promise((resolve, reject) => { let data = Buffer.from([0x41, 0x34, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]); this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, data); - if (color === false) { + if (typeof color === "boolean") { color = 0; } data = Buffer.from([0x81, 0x34, 0x11, 0x51, 0x00, color]); diff --git a/src/wedo2smarthub.ts b/src/wedo2smarthub.ts index 6cd5537..b17a16a 100644 --- a/src/wedo2smarthub.ts +++ b/src/wedo2smarthub.ts @@ -135,7 +135,7 @@ export class WeDo2SmartHub extends Hub { return new Promise((resolve, reject) => { let data = Buffer.from([0x06, 0x17, 0x01, 0x01]); this._writeMessage(Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE, data); - if (color === false) { + if (typeof color === "boolean") { color = 0; } data = Buffer.from([0x06, 0x04, 0x01, color]);