Skip to content

Commit

Permalink
fix(typescript): OnConnectCallback with specs expecting Connack packet (
Browse files Browse the repository at this point in the history
#1333)

* 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

* Add @types/ws in devDependencies
Restore noImplicitAny typescript rule
  • Loading branch information
ccarcaci authored Oct 4, 2021
1 parent c92b877 commit e3e15c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,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",
Expand Down
4 changes: 2 additions & 2 deletions types/lib/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e3e15c3

Please sign in to comment.