From bcc5497b1610c498d24ea04656cc7dc033002d06 Mon Sep 17 00:00:00 2001 From: hjdhjd Date: Sun, 26 Nov 2023 17:31:51 -0600 Subject: [PATCH 1/4] Fix module exports for TypeScript for ES6 compliance --- aedes.d.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/aedes.d.ts b/aedes.d.ts index 3735efdf..f528be18 100644 --- a/aedes.d.ts +++ b/aedes.d.ts @@ -1,12 +1,5 @@ -import Aedes, { AedesOptions } from './types/instance' +export * from './types/instance'; +export * from './types/packet'; +export * from './types/client'; -export declare function createBroker (options?: AedesOptions): Aedes - -export * from './types/instance' -export * from './types/packet' -export * from './types/client' -export default Aedes - -declare module 'aedes' { - export = Aedes -} +export { default } from './types/instance'; From 71708f246ff4412b05f2c3b849e9ca6ab9b46b28 Mon Sep 17 00:00:00 2001 From: hjdhjd Date: Mon, 27 Nov 2023 12:01:13 -0600 Subject: [PATCH 2/4] Provide an explicit export for createBroker. --- aedes.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aedes.d.ts b/aedes.d.ts index f528be18..24a00209 100644 --- a/aedes.d.ts +++ b/aedes.d.ts @@ -1,3 +1,7 @@ +import Aedes, { AedesOptions } from './types/instance' + +export declare function createBroker(options?: AedesOptions): Aedes; + export * from './types/instance'; export * from './types/packet'; export * from './types/client'; From 2fada5888adc13ff0bbe51b193f812d11c4074fa Mon Sep 17 00:00:00 2001 From: hjdhjd Date: Tue, 5 Dec 2023 13:14:07 -0600 Subject: [PATCH 3/4] Update aedes.test-d.ts Add additional validation testing for createBroker. --- test/types/aedes.test-d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/types/aedes.test-d.ts b/test/types/aedes.test-d.ts index 30e34168..744ee3da 100644 --- a/test/types/aedes.test-d.ts +++ b/test/types/aedes.test-d.ts @@ -6,10 +6,13 @@ import type { Client, Connection } from '../../aedes' -import Aedes, { createBroker } from '../../aedes' +import Aedes, { AedesOptions, createBroker } from '../../aedes' import type { AedesPublishPacket, ConnackPacket, ConnectPacket, PingreqPacket, PublishPacket, PubrelPacket, Subscription, SubscribePacket, UnsubscribePacket } from '../../types/packet' import { expectType } from 'tsd' +// Test for createBroker function +expectType<(options?: AedesOptions) => Aedes>(createBroker) + // Aedes server let broker = createBroker() expectType(broker) From 624263b5e9f1a36b7695d2d24cd391319d32bad5 Mon Sep 17 00:00:00 2001 From: hjdhjd Date: Wed, 6 Dec 2023 11:07:44 -0600 Subject: [PATCH 4/4] Linting --- aedes.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aedes.d.ts b/aedes.d.ts index 24a00209..fa54adf8 100644 --- a/aedes.d.ts +++ b/aedes.d.ts @@ -1,9 +1,9 @@ import Aedes, { AedesOptions } from './types/instance' -export declare function createBroker(options?: AedesOptions): Aedes; +export declare function createBroker(options?: AedesOptions): Aedes -export * from './types/instance'; -export * from './types/packet'; -export * from './types/client'; +export * from './types/instance' +export * from './types/packet' +export * from './types/client' -export { default } from './types/instance'; +export { default } from './types/instance'