mqttjs / async-mqtt

Promise wrapper over MQTT.js
MIT License
272 stars 50 forks source link

Add TypeScript typings #10

Closed bdchauvette closed 5 years ago

bdchauvette commented 5 years ago

Thanks for the work on promisifying mqtt!

This PR just adds TypeScript typings based on the ones from mqtt.

The typings re-export everything from mqtt, except for the MqttClient class and connect.

Although they don't export the MqttClient class, they do export the MqttClient interface as IMqttClient, to make it clearer that the package doesn't export the actual MqttClient class.

The AsyncMqttClient class declaration extends from MqttClient, and does some never-based trickery to overload the original methods with the promisified ones. I thought that this would be cleaner than re-writing the entire MqttClient interface, when all we really need are a few overloads.

RangerMauve commented 5 years ago

Nice! It looks good to me other than the package-lock.json. Would you mind deleting that for now?

RangerMauve commented 5 years ago

Thank you so much!

There's another PR in the works, #11 , I'll release this once that lands.

bdchauvette commented 5 years ago

Great, thanks!