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

View type missing optional id from response #436

Closed
5 of 9 tasks
tteltrab opened this issue Mar 23, 2020 · 1 comment · Fixed by #437
Closed
5 of 9 tasks

View type missing optional id from response #436

tteltrab opened this issue Mar 23, 2020 · 1 comment · Fixed by #437
Assignees
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented TypeScript-specific

Comments

@tteltrab
Copy link
Contributor

Description

In the docs, in re: updating views

To update a view, you can use the built-in client to call views.update with the view_id that was generated when you opened the view, and the updated blocks array. If you’re updating the view when a user interacts with an element inside of an existing view, the view_id will be available in the body of the request.

app.action('button_abc', ({ ack, body, context }) => {
  // Acknowledge the button request
  ack();
  try {
    const result = app.client.views.update({
      token: context.botToken,
      // Pass the view_id
      view_id: body.view.id,

Typescript bindings for View don't have an id property on the interface, which is causing errors. https://github.com/slackapi/node-slack-sdk/blob/master/packages/types/src/index.ts#L35

Not sure about this type, also not sure about opening the issue here, I understand the type is there ^ but it seems the intent of the View type is to be the view object sent with views.open API call, not to handle the ViewResponse which has an id.

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

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Bugfeature? It's an enhancement to the type bindings, but I can't reference a value that is definitely there in the response because of it when using typescript (have to give it the good old @ts-ignore).

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

Reproducible in:

package version: 1.8.0

node version: 12.14.1

OS version(s): MacOS 10.15.1

Steps to reproduce:

  1. See above description

Expected result:

Should be able to reference body.view.id

Actual result:

TypeError

Attachments:

image

image

@seratch seratch added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented TypeScript-specific labels Mar 24, 2020
@seratch seratch self-assigned this Mar 24, 2020
@seratch
Copy link
Member

seratch commented Mar 24, 2020

@tteltrab Thank you for taking the time to flag this. I'll work on the fix.

seratch added a commit to seratch/bolt-js that referenced this issue Mar 24, 2020
seratch added a commit to seratch/bolt-js that referenced this issue Mar 24, 2020
stevengill added a commit that referenced this issue Mar 24, 2020
Fix #436 View type missing optional id from response
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.

2 participants