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
This could be confusing but the message object is typed as union type of 10 patterns in app.message listeners. So, at the top-level, only the most common properties are available in TS types while all properties exist at runtime.
To deal with that, you can have if/else statements to determine what payload pattern is. The code block inside the if/else statements can safely access more specific message payload data type. Usually, checking the value of "subtype" of message events is the way to go. Refer to #796 (comment) for more details.
We know this is not ideal developer experience, and we are still exploring the way to improve it without any breaking changes. However, we are unable to tell when and how it may come in the future.
I hope this helps.
seratch
changed the title
app.message() does not expose all message properties
app.message() does not expose all message properties in TS
Mar 12, 2023
(Filling out the following with as much detail as you can provide will help us solve your issue sooner.)
Reproducible in:
3.12.2
The Slack SDK version
3.12.2
(Paste the output of)
or refer to your
package.json
Node.js runtime version
v18.12.1
(Paste the output of
node --version
)OS info
(Paste the output of
sw_vers && uname -v
on macOS/Linux orver
on Windows OS)Steps to reproduce:
What's available in the type:
Expected result:
What I can log:
I should be able to see all of those types. I don't see them in
req.event
,req.message
,req.payload
, or any child ofreq.body
for typescript.These are very useful keys
The text was updated successfully, but these errors were encountered: