Skip to content

Commit 28c4040

Browse files
fix(types): connect function proper overloads for its parameters (#1416)
1 parent 9eb4c79 commit 28c4040

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

types/lib/connect/index.d.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
import { IClientOptions, MqttClient } from '../client'
1+
import { IClientOptions, MqttClient } from "../client";
22
/**
33
* connect - connect to an MQTT broker.
44
*
5-
* @param {String} [brokerUrl] - url of the broker, optional
5+
* @param {String} brokerUrl - url of the broker
6+
*/
7+
declare function connect(brokerUrl: string): MqttClient;
8+
9+
/**
10+
* connect - connect to an MQTT broker.
11+
*
12+
* @param {Object} opts - see MqttClient#constructor
13+
*/
14+
declare function connect(opts: IClientOptions): MqttClient;
15+
16+
/**
17+
* connect - connect to an MQTT broker.
18+
*
19+
* @param {String} brokerUrl - url of the broker
620
* @param {Object} opts - see MqttClient#constructor
721
*/
8-
declare function connect (brokerUrl?: string | any, opts?: IClientOptions): MqttClient
9-
export { connect }
10-
export { MqttClient }
22+
declare function connect(brokerUrl: string, opts: IClientOptions): MqttClient;
23+
24+
export { connect };
25+
export { MqttClient };

0 commit comments

Comments
 (0)