You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
web.channels.list((err,res)=>{if(err){returnconsole.error(err);}// `res` contains information about the channelsres.channels.forEach(c=>console.log(c.name));});
While, web.channels.list({}, callback) does work, when omitting the options parameter the callback will not be called due to
// Adapt the interface for callback-based execution or Promise-based execution
if(callback!==undefined){
callbackify(implementation)(callback);
return;
}
returnimplementation();
When compiled to JS, apiCall has a signature of function (method, options, callback) {}. If options is not passed, callback will be undefined and a promise will be returned instead.
A potential solution would be to check typeof options === 'function' to see if options is actually the callback.
What type of issue is this?
bug
enhancement (feature request)
question
documentation related
testing related
discussion
Requirements (place an x in each of the [ ])
I've read and understood the Contributing guidelines and have done my best effort to follow them.
so i'd describe this as a documentation issue. if you'd like us to consider making options optional, then let's open a separate feature request issue for that.
Description
https://slackapi.github.io/node-slack-sdk/web_api#using-a-callback-instead-of-a-promise lists the following example:
While,
web.channels.list({}, callback)
does work, when omitting the options parameter the callback will not be called due tonode-slack-sdk/src/WebClient.ts
Lines 302 to 307 in b207d88
When compiled to JS,
apiCall
has a signature offunction (method, options, callback) {}
. Ifoptions
is not passed,callback
will be undefined and a promise will be returned instead.A potential solution would be to check
typeof options === 'function'
to see ifoptions
is actually the callback.What type of issue is this?
Requirements (place an
x
in each of the[ ]
)Bug Report
Reproducible in:
@slack/client
version: 4.4.0, also verified in 4.0.0node version: 8.11.4
OS version(s): macOS High Sierra
Steps to reproduce:
Expected result:
Channels should be logged
Actual result:
No channels logged due to callback not being called.
The text was updated successfully, but these errors were encountered: