Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): module exports for TypeScript for ES6 compliance. #918

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you removed this?

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