Skip to content

Commit

Permalink
define typings of publish and publishUnsafe more precisely. Resolves #…
Browse files Browse the repository at this point in the history
  • Loading branch information
sclausen committed Apr 2, 2019
1 parent bbd5e28 commit c45c28d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ src/**/*.js
src/**/*.d.ts
src/**/*.metadata.json
package-lock.json
.idea
*.map
*.js
*.d.ts
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/mqtt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
public publish(topic: string, message: string | Buffer, options?: IPublishOptions): Observable<void> {
if (!this.client) {
throw new Error('mqtt client not connected');
}
Expand All @@ -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');
}
Expand Down

0 comments on commit c45c28d

Please sign in to comment.