From 1cace1417e06bb1465bc5a2eaf04824caf156e13 Mon Sep 17 00:00:00 2001 From: ccarcaci Date: Thu, 30 Sep 2021 06:51:41 +0200 Subject: [PATCH 1/2] Set noImplicitAny to false in test/typescript/tsconfig.json due to a compilation error resolving ws types OnConnectCallback receives back a Connack packet as stated in the MQTT specs --- test/typescript/tsconfig.json | 2 +- types/lib/client.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/typescript/tsconfig.json b/test/typescript/tsconfig.json index 0b8d393ac..415c27603 100644 --- a/test/typescript/tsconfig.json +++ b/test/typescript/tsconfig.json @@ -4,7 +4,7 @@ "target": "es5", "moduleResolution": "node", "noEmitOnError": true, - "noImplicitAny": true, + "noImplicitAny": false, "alwaysStrict": true, "strictNullChecks": true, "noImplicitReturns": true, diff --git a/types/lib/client.d.ts b/types/lib/client.d.ts index 7821a96d7..c439fe89e 100644 --- a/types/lib/client.d.ts +++ b/types/lib/client.d.ts @@ -8,7 +8,7 @@ import { IClientReconnectOptions } from './client-options' import { Store } from './store' -import { Packet, IConnectPacket, IPublishPacket, IDisconnectPacket, QoS } from 'mqtt-packet' +import { Packet, IConnectPacket, IPublishPacket, IDisconnectPacket, QoS, IConnackPacket } from 'mqtt-packet' export interface ISubscriptionGrant { /** @@ -66,7 +66,7 @@ export interface ISubscriptionMap { } } -export declare type OnConnectCallback = (packet: IConnectPacket) => void +export declare type OnConnectCallback = (packet: IConnackPacket) => void export declare type OnDisconnectCallback = (packet: IDisconnectPacket) => void export declare type ClientSubscribeCallback = (err: Error, granted: ISubscriptionGrant[]) => void export declare type OnMessageCallback = (topic: string, payload: Buffer, packet: IPublishPacket) => void From 1323cbbc290066eba4a6cf31b20c63ce37d4cfe0 Mon Sep 17 00:00:00 2001 From: ccarcaci Date: Mon, 4 Oct 2021 22:22:53 +0200 Subject: [PATCH 2/2] Add @types/ws in devDependencies Restore noImplicitAny typescript rule --- package.json | 3 ++- test/typescript/tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3be7ba77e..fbbbce582 100644 --- a/package.json +++ b/package.json @@ -80,13 +80,14 @@ }, "devDependencies": { "@types/node": "^10.0.0", + "@types/ws": "^8.2.0", + "aedes": "^0.42.5", "airtap": "^3.0.0", "browserify": "^16.5.0", "chai": "^4.2.0", "codecov": "^3.0.4", "end-of-stream": "^1.4.1", "global": "^4.3.2", - "aedes": "^0.42.5", "mkdirp": "^0.5.1", "mocha": "^4.1.0", "mqtt-connection": "^4.0.0", diff --git a/test/typescript/tsconfig.json b/test/typescript/tsconfig.json index 415c27603..0b8d393ac 100644 --- a/test/typescript/tsconfig.json +++ b/test/typescript/tsconfig.json @@ -4,7 +4,7 @@ "target": "es5", "moduleResolution": "node", "noEmitOnError": true, - "noImplicitAny": false, + "noImplicitAny": true, "alwaysStrict": true, "strictNullChecks": true, "noImplicitReturns": true,