moscajs / aedes

Barebone MQTT broker that can run on any stream server, the node way
MIT License
1.75k stars 228 forks source link

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

Closed hjdhjd closed 7 months ago

hjdhjd commented 7 months ago

Addresses https://github.com/moscajs/aedes/issues/878#issuecomment-1825783310 and corrects the export declaration in TypeScript.

hjdhjd commented 7 months ago

It is correct, and I've confirmed its use.

To explain it more verbosely:

// Since Aedes is a default export from './types/instance', we can do this:
export { default } from './types/instance';

// If Aedes was NOT the default export, we would need to create an alias for the default export like so:
// export { default as Aedes } from './types/instance';

Agree on createBroker...I can add it back in, though I suspect it's superfluous. Let me know. The bug this fixes prevents me from using the latest Aedes and I'm forced to use 0.49 in the meantime.

robertsLando commented 7 months ago

Could you add a typescript test that covers this to prevent any possible breaking change?

hjdhjd commented 7 months ago

Could you add a typescript test that covers this to prevent any possible breaking change?

Added an additional check for createBroker, but there's not much more I can do here. Do let me know if you're going to accept this or not - I'd like to get this PR closed out either way. Thanks.

hjdhjd commented 7 months ago

Linting done.

coveralls commented 7 months ago

Pull Request Test Coverage Report for Build 7117819105


Totals Coverage Status
Change from base Build 6798861432: 0.0%
Covered Lines: 816
Relevant Lines: 816

💛 - Coveralls