From c45c28daec1ece2e5da0b4e07b9274e2cf72db9d Mon Sep 17 00:00:00 2001 From: sclausen Date: Tue, 2 Apr 2019 11:55:50 +0200 Subject: [PATCH] define typings of publish and publishUnsafe more precisely. Resolves #131. --- .gitignore | 1 + package.json | 2 +- src/mqtt.service.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 419bfaa..19bd0c7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ src/**/*.js src/**/*.d.ts src/**/*.metadata.json package-lock.json +.idea *.map *.js *.d.ts diff --git a/package.json b/package.json index ed9f244..3a4ace3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-mqtt", - "version": "6.8.5", + "version": "6.9.0", "description": "ngx mqtt client library", "main": "bundles/ngx-mqtt.min.js", "module": "./src/index.js", diff --git a/src/mqtt.service.ts b/src/mqtt.service.ts index 11f5cf3..817357c 100644 --- a/src/mqtt.service.ts +++ b/src/mqtt.service.ts @@ -220,7 +220,7 @@ export class MqttService { * the observable will emit an empty value and completes, if publishing was successful * or throws an error, if the publication fails. */ - public publish(topic: string, message: any, options?: IPublishOptions): Observable { + public publish(topic: string, message: string | Buffer, options?: IPublishOptions): Observable { if (!this.client) { throw new Error('mqtt client not connected'); } @@ -241,7 +241,7 @@ export class MqttService { * This method publishes a message for a topic with optional options. * If an error occurs, it will throw. */ - public unsafePublish(topic: string, message: any, options?: IPublishOptions): void { + public unsafePublish(topic: string, message: string | Buffer, options?: IPublishOptions): void { if (!this.client) { throw new Error('mqtt client not connected'); }