diff --git a/aedes.d.ts b/aedes.d.ts index 3735efdf..fa54adf8 100644 --- a/aedes.d.ts +++ b/aedes.d.ts @@ -1,12 +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 default Aedes -declare module 'aedes' { - export = Aedes -} +export { default } from './types/instance' 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)