Skip to content

Commit

Permalink
fix(types): module exports for TypeScript for ES6 compliance. (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdhjd authored Dec 8, 2023
1 parent 3180f2a commit 6662b37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 2 additions & 5 deletions aedes.d.ts
Original file line number Diff line number Diff line change
@@ -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'
5 changes: 4 additions & 1 deletion test/types/aedes.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Aedes>(broker)
Expand Down

0 comments on commit 6662b37

Please sign in to comment.