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

ViewSubmitAction type missing trigger_id #572

Closed
4 of 9 tasks
SpencerKaiser opened this issue Aug 11, 2020 · 1 comment · Fixed by #828
Closed
4 of 9 tasks

ViewSubmitAction type missing trigger_id #572

SpencerKaiser opened this issue Aug 11, 2020 · 1 comment · Fixed by #828
Assignees
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented TypeScript-specific

Comments

@SpencerKaiser
Copy link

SpencerKaiser commented Aug 11, 2020

Description

On view submission, the body element of the response includes a trigger_id value which can be used to perform additional actions. The ViewSubmitAction type does not include trigger_id so when handling the event, body does not include this value.

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

  • 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.
  • 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

body is missing from within ViewSubmitAction

Reproducible in:

package version: 2.0.1

node version: 12.12.0

OS version(s): macOS 10.15.6

Steps to reproduce:

  1. Handle a view submission event with a listener and try to access trigger_id within body
export const someViewSubmission: Middleware<SlackViewMiddlewareArgs<ViewSubmitAction>> = async ({ ack, body }) => {
  ack();
  const { trigger_id } = (body as unknown) as { [id: string]: string };
  console.log(trigger_id); // trigger_id is defined

  // Property 'trigger_id' does not exist on type 'ViewSubmitAction'.ts(2339)
  // const { trigger_id } = body;
}

Expected result:

No type error, trigger_id is accessible

Actual result:

Type error but value is accessible when asserting as another type

Workaround

Included in snippet above, just assert as unknown then as a string: string dictionary

@SpencerKaiser
Copy link
Author

@aoberoi I never know if these are bolt or @slack/types related. Let me know if this is better on that project, but I think this is a bolt-specific one.

@stevengill stevengill added the bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented label Aug 11, 2020
@misscoded misscoded self-assigned this Mar 11, 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 TypeScript-specific
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants