From debb7d93c17f5b68704c160ccd88e7e1db87d92d Mon Sep 17 00:00:00 2001 From: Takatoshi Kondo Date: Fri, 14 Jul 2023 15:14:44 +0900 Subject: [PATCH] fix(types): subscribe definition (#1527) --- types/lib/client-options.d.ts | 9 +++++++++ types/lib/client.d.ts | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/types/lib/client-options.d.ts b/types/lib/client-options.d.ts index 68f05d4b1..cbf1ca77a 100644 --- a/types/lib/client-options.d.ts +++ b/types/lib/client-options.d.ts @@ -196,6 +196,15 @@ export interface IClientSubscribeOptions { userProperties?: UserProperties } } +export interface IClientSubscribeProperties { + /* + * MQTT 5.0 properies object of subscribe + * */ + properties?: { + subscriptionIdentifier?: number, + userProperties?: UserProperties + } +} export interface IClientReconnectOptions { /** * a Store for the incoming packets diff --git a/types/lib/client.d.ts b/types/lib/client.d.ts index 029a8a300..8693cf4ff 100644 --- a/types/lib/client.d.ts +++ b/types/lib/client.d.ts @@ -5,6 +5,7 @@ import { IClientOptions, IClientPublishOptions, IClientSubscribeOptions, + IClientSubscribeProperties, IClientReconnectOptions } from './client-options' import { Store } from './store' @@ -164,7 +165,11 @@ export declare class MqttClient extends events.EventEmitter { */ public subscribe (topic: string - | string[], opts: IClientSubscribeOptions, callback?: ClientSubscribeCallback): this + | string[] + | ISubscriptionMap, + opts: + IClientSubscribeOptions + | IClientSubscribeProperties, callback?: ClientSubscribeCallback): this public subscribe (topic: string | string[]