crisboarna / fb-messenger-bot-api

NodeJS Facebook Messenger API for bots to send messages and setup events to Facebook.
https://www.npmjs.com/package/fb-messenger-bot-api
MIT License
34 stars 17 forks source link

Don't return 'Promise<{}> | undefined' from the api calls #71

Closed MartinSahlen closed 5 years ago

MartinSahlen commented 5 years ago

the return signature Promise<{}> | undefined is problematic due to [ts] Object is possibly 'undefined'.. I get the fact that you want to accomodate both callbacks and promises, but one doesnt exclude the other, maybe I'm crazy and want both a callback and a promise returned? I can't see it do any harm to have a promise signature.

crisboarna commented 5 years ago

Hey @MartinSahlen, thank you for the interest in the module! It is a reasonable request, I see logic behind it, what would you recommend as best practice to this? To return nothing, empty object... Something else?

MartinSahlen commented 5 years ago

Ah, sorry if I was unclear! I meant that we should always return a promise, regardless if a callback is provided or not. the promise type should probably void to be more idiomatically correct, i.e it will always return a Promise<void>.

crisboarna commented 5 years ago

:tada: This issue has been resolved in version 4.2.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: