Skip to content

Improved TypeScript declarations for userProperties #103

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

Merged
merged 2 commits into from
Feb 12, 2021

Conversation

bkp7
Copy link
Contributor

@bkp7 bkp7 commented Feb 11, 2021

userProperties changed from being object to being {[index: string]: string} (name-value string pairs)

fixes #102

userProperties changed from being object to being {[index: string]: string} (name-value string pairs)
@scarry1992
Copy link
Contributor

scarry1992 commented Feb 11, 2021

UserProperty can be an array, because by mqtt5 specification each userProperty can be few times in one packet. So your declaration is wrong. So it have two forms: {[index: string]: string} and {[index: string]: Array}

@bkp7
Copy link
Contributor Author

bkp7 commented Feb 11, 2021

@scarry1992, changed to allow for the array.

I also wanted to make a PR on MQTT.js to use this but it would be dependent on an version of mqtt-packet with this change in it. How do you manage that scenario?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina requested a review from scarry1992 February 12, 2021 15:05
@mcollina mcollina merged commit da57686 into mqttjs:master Feb 12, 2021
@bkp7 bkp7 deleted the bkp7-typescript-changes branch February 12, 2021 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Current Typescript definitions are difficult to use to read userProperties
3 participants