Skip to content
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

MessageEvent type missing user #774

Closed
4 of 10 tasks
sakin97 opened this issue Jan 29, 2021 · 2 comments
Closed
4 of 10 tasks

MessageEvent type missing user #774

sakin97 opened this issue Jan 29, 2021 · 2 comments
Assignees
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented

Comments

@sakin97
Copy link

sakin97 commented Jan 29, 2021

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code 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.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

MessageEvent type mission user

Reproducible in:

package version: 3.1.1

node version: 14.1

OS version(s): MacOS 11.1

Steps to reproduce:

  1. Define an app.message("hello", async ({ message, say }) => { ... listener.
  2. Try to access message.user

Expected result:

The type of message argument should have the user property.

Actual result:

Property 'user' does not exist on type 'MessageEvent'.
Property 'user' does not exist on type 'MessageChangedEvent'.

Full reproduction code:

import { App } from "@slack/bolt";

const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  signingSecret: process.env.SLACK_SIGNING_SECRET,
});

// Listens to incoming messages that contain "goodbye"
app.message("hello", async ({ message, say }) => {
  // say() sends a message to the channel where the event was triggered
  await say(`hello,  <@${message.user}> :wave:`);
});

(async () => {
  await app.start(process.env.PORT || 3000);
  console.log("Bolt app is running!");
})();

Workaround

Add assertion like this: (message as GenericMessageEvent).user

@gitwave gitwave bot added the untriaged label Jan 29, 2021
@sakin97 sakin97 changed the title MessageEvent type mission user MessageEvent type missing user Jan 29, 2021
@seratch
Copy link
Member

seratch commented Jan 29, 2021

Hey @sunakane, thanks for taking the time to report this issue! It seems that you are right. This should be a bug introduced by #709. The Slack team will fix this issue shortly but, if you are interested in making a pull request for this, we are happy to be reviewers on it 👋

@seratch seratch added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented and removed untriaged labels Jan 29, 2021
@shaydewael shaydewael self-assigned this Feb 5, 2021
@shaydewael shaydewael mentioned this issue Feb 8, 2021
2 tasks
@seratch
Copy link
Member

seratch commented Mar 5, 2021

Fixed by #782 - let me close this issue now.

@seratch seratch closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented
Projects
None yet
Development

No branches or pull requests

3 participants