Fixed typescript errors

This commit is contained in:
Nathan Kellenicki 2019-04-25 21:57:16 -07:00
parent a394882dcc
commit 2c08e8b3ee
4 changed files with 4 additions and 4 deletions

View File

@ -94,7 +94,7 @@ export class DuploTrainBase extends LPF2Hub {
*/ */
public setLEDColor (color: number | boolean) { public setLEDColor (color: number | boolean) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (color === false) { if (typeof color === "boolean") {
color = 0; color = 0;
} }
const data = Buffer.from([0x81, 0x11, 0x11, 0x51, 0x00, color]); const data = Buffer.from([0x81, 0x11, 0x11, 0x51, 0x00, color]);

View File

@ -89,7 +89,7 @@ export class LPF2Hub extends Hub {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let data = Buffer.from([0x41, 0x32, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]); let data = Buffer.from([0x41, 0x32, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]);
this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, data); this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, data);
if (color === false) { if (typeof color === "boolean") {
color = 0; color = 0;
} }
data = Buffer.from([0x81, 0x32, 0x11, 0x51, 0x00, color]); data = Buffer.from([0x81, 0x32, 0x11, 0x51, 0x00, color]);

View File

@ -95,7 +95,7 @@ export class PUPRemote extends LPF2Hub {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let data = Buffer.from([0x41, 0x34, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]); let data = Buffer.from([0x41, 0x34, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]);
this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, data); this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, data);
if (color === false) { if (typeof color === "boolean") {
color = 0; color = 0;
} }
data = Buffer.from([0x81, 0x34, 0x11, 0x51, 0x00, color]); data = Buffer.from([0x81, 0x34, 0x11, 0x51, 0x00, color]);

View File

@ -135,7 +135,7 @@ export class WeDo2SmartHub extends Hub {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let data = Buffer.from([0x06, 0x17, 0x01, 0x01]); let data = Buffer.from([0x06, 0x17, 0x01, 0x01]);
this._writeMessage(Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE, data); this._writeMessage(Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE, data);
if (color === false) { if (typeof color === "boolean") {
color = 0; color = 0;
} }
data = Buffer.from([0x06, 0x04, 0x01, color]); data = Buffer.from([0x06, 0x04, 0x01, color]);