diff --git a/lib/connect/ali.js b/lib/connect/ali.js index aae76acf1..3cdfa6334 100644 --- a/lib/connect/ali.js +++ b/lib/connect/ali.js @@ -1,5 +1,6 @@ 'use strict' +const { Buffer } = require('buffer') const Transform = require('readable-stream').Transform const duplexify = require('duplexify') diff --git a/lib/connect/ws.js b/lib/connect/ws.js index c7e2e15f8..21b94e610 100644 --- a/lib/connect/ws.js +++ b/lib/connect/ws.js @@ -1,5 +1,6 @@ 'use strict' +const { Buffer } = require('buffer') const WS = require('ws') const debug = require('debug')('mqttjs:ws') const duplexify = require('duplexify') diff --git a/lib/connect/wx.js b/lib/connect/wx.js index 61b38e473..0dc94a038 100644 --- a/lib/connect/wx.js +++ b/lib/connect/wx.js @@ -1,5 +1,6 @@ 'use strict' +const { Buffer } = require('buffer') const Transform = require('readable-stream').Transform const duplexify = require('duplexify') diff --git a/types/lib/connect/index.d.ts b/types/lib/connect/index.d.ts index 1c85b9ca8..bbcaf97a0 100644 --- a/types/lib/connect/index.d.ts +++ b/types/lib/connect/index.d.ts @@ -1,17 +1,11 @@ -import { IClientOptions, MqttClient } from "../client"; -/** - * connect - connect to an MQTT broker. - * - * @param {String} brokerUrl - url of the broker - */ -declare function connect(brokerUrl: string): MqttClient; +import { IClientOptions, MqttClient } from '../client' /** * connect - connect to an MQTT broker. * * @param {Object} opts - see MqttClient#constructor */ -declare function connect(opts: IClientOptions): MqttClient; +declare function connect (opts: IClientOptions): MqttClient /** * connect - connect to an MQTT broker. @@ -19,7 +13,7 @@ declare function connect(opts: IClientOptions): MqttClient; * @param {String} brokerUrl - url of the broker * @param {Object} opts - see MqttClient#constructor */ -declare function connect(brokerUrl: string, opts: IClientOptions): MqttClient; +declare function connect (brokerUrl: string, opts?: IClientOptions): MqttClient -export { connect }; -export { MqttClient }; +export { connect } +export { MqttClient }