The Wayback Machine - https://web.archive.org/web/20220319151027/https://github.com/slackapi/node-slack-sdk/issues/1172
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

type definition of ChatPostMessageArguments has incorrect property #1172

Closed
5 of 17 tasks
kentac55 opened this issue Feb 10, 2021 · 3 comments · Fixed by #1173
Closed
5 of 17 tasks

type definition of ChatPostMessageArguments has incorrect property #1172

kentac55 opened this issue Feb 10, 2021 · 3 comments · Fixed by #1173

Comments

@kentac55
Copy link
Contributor

@kentac55 kentac55 commented Feb 10, 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
  • 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

Type definition of ChatPostMessageArguments has message as required property but in slack api doc, as optional property.

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/events-api
  • @slack/interactive-messages
  • @slack/rtm-api
  • @slack/webhooks
  • @slack/oauth
  • @slack/socket-mode
  • I don't know

Reproducible in:

package version: 6.0.0

node version: 14.15.4

OS version(s): Linux 5.10.14-arch1-1 SMP PREEMPT Sun, 07 Feb 2021 22:42:17 +0000 x86_64 GNU/Linux

Steps to reproduce:

  1. write code as below

    webClient.chat.postMessage({
      channel: 'C0BQ8GW78',
      blocks: [
        {
          type: 'section',
          text: {
            type: 'mrkdwn',
            text:
              "Hello, Assistant to the Regional Manager Dwight! *Michael Scott* wants to know where you'd like to take the Paper Company investors to dinner tonight.\n\n *Please select a restaurant:*",
          },
        },
      ],
    })
  2. run tsc

  3. got error

    src/index.ts:105:28 - error TS2345: Argument of type '{ channel: string; blocks: { type: "section"; text: { type: "mrkdwn"; text: string; }; }[]; }' is not assignable to parameter of type 'ChatPostMessageArguments'.
      Property 'text' is missing in type '{ channel: string; blocks: { type: "section"; text: { type: "mrkdwn"; text: string; }; }[]; }' but required in type 'ChatPostMessageArguments'.
    

Expected result:

No error occured.

Actual result:

Compile failed.

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.

@gitwave gitwave bot added the untriaged label Feb 10, 2021
kentac55 added a commit to kentac55/node-slack-sdk that referenced this issue Feb 10, 2021
kentac55 added a commit to kentac55/node-slack-sdk that referenced this issue Feb 11, 2021
@Stono
Copy link

@Stono Stono commented Feb 12, 2021

+1 to this, getting hit by it now!

@seratch
Copy link
Member

@seratch seratch commented Feb 16, 2021

Thanks for taking the time to write in and we are sorry for our slow response here.

We had a discussion on this issue in the past: #853

The outcome of the discussion in the issue was that we can loosen the limit (in this library) if we add warning log output for the missing text field: #1128

We've already implemented the warning message in Python SDK and Java SDK:

We would like to have a similar one in this Node SDK too. If you are interested in implementing the warning, it'd be greatly appreciated.

@kentac55
Copy link
Contributor Author

@kentac55 kentac55 commented Feb 16, 2021

I'm sorry for my poor search skills. 🙇
I see. I'll work on its implementation 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment