-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Typescript types #519
Typescript types #519
Conversation
Related to: bencevans#512
@pascalopitz can you check if you application still works with all these types now included. I've tried to not break anything and just including a first version of the types. Installing with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🎉 This PR is included in version 1.15.0-alpha.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@svrooij Nope, not looking good for me |
@pascalopitz The AsyncDeviceDiscovery is the only thing I've changed. A promise cannot return multiple arguments, so I changed it to return an object with if you change this to: async searchForDevices(timeout = 1000) {
const discovered = await new AsyncDeviceDiscovery().discover({
timeout,
port: SONOS_DISCOVERY_PORT,
});
await this.connectDevice(discovered.device);
}, Did this fix your app? Or are you facing tons of troubles? Related code: node-sonos/lib/asyncDeviceDiscovery.js Lines 9 to 21 in bea996e
|
Confirmed. I just figured out the same ... |
If you're facing any other issues with the new alpha, could you create a new issue? |
I've managed to get started with generating Typescript definition files from existing Javascript code I followed this manual.
This way everybody that likes to use the Sonos library can also enjoy the comfort of automatic documentation.
This PR includes a first version of the type definition. The types are also generated in the prepack stage, so they will never become outdated.
Improving the type definition can be done by adding jsdoc comments to the javascript code.
Check this sample
https://github.com/svrooij/node-sonos/blob/9a87007e3aa81886fca274ed301a64f3bb7ff2ab/lib/services/alarm-clock.service.js#L30-L45
Fixed #512 @realwakils
What do you think @bencevans