Skip to content

WorkflowButton block element missing required action_id property #2207

@fkywong

Description

@fkywong

Packages:

Select all that apply:

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

Reproducible in:

The Slack SDK version

2.14.0

Node.js runtime version

N/A; I'm running Deno:

$ deno --version        
# deno 2.2.2 (stable, release, aarch64-apple-darwin)
# v8 13.4.114.9-rusty
# typescript 5.7.3

OS info

$ sw_vers && uname -v
# ProductName:            macOS
# ProductVersion:         14.7.4
# BuildVersion:           23H420
# Darwin Kernel Version 23.6.0: Thu Dec 19 20:47:53 PST 2024; root:xnu-10063.141.1.703.2~1/RELEASE_ARM64_T6030

Steps to reproduce:

Example source code:

import { PlainTextElement, WorkflowButton } from "@slack/types";

export function getAWorkflowButton(triggerUrl: string): WorkflowButton {
  return {
    type: "workflow_button",
    text: {
      type: "plain_text",
      text: "I am a workflow button",
    } as PlainTextElement,
    action_id: "action_12345",
    workflow: {
      trigger: { url: triggerUrl },
    },
  };
}

Expected result:

deno check passes.

Actual result:

deno check fails with an unknown property error for action_id even though the documented API for a workflow button specifies action_id as a required field:

Check file:///Volumes/<REDACTED>/foo.ts
TS2353 [ERROR]: Object literal may only specify known properties, and 'action_id' does not exist in type 'WorkflowButton'.
    action_id: "action_12345",
    ~~~~~~~~~
    at file:///Volumes/<REDACTED>/foo.ts:10:5

error: Type checking failed.

Suspected issue

I believe the exported WorkflowButton type from block-elements.ts is missing extending the Actionable interface.

export interface WorkflowButton extends Confirmable {

export interface Action {
type: string;
/**
* @description: An identifier for this action. You can use this when you receive an interaction payload to
* {@link https://api.slack.com/interactivity/handling#payloads identify the source of the action}. Should be unique
* among all other `action_id`s in the containing block. Maximum length for this field is 255 characters.
*/
action_id?: string;
}
export interface Actionable extends Action {}

Spot-checking a handful of other interactive components (eg. Button, Checkboxes, NumberInput, etc.) show that they all extend the Actionable interface:

export interface Button extends Actionable, Confirmable {

export interface Datepicker extends Actionable, Confirmable, Focusable, Placeholdable {

export interface NumberInput extends Actionable, Dispatchable, Focusable, Placeholdable {

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:typescriptissues that specifically impact using the package from typescript projectsauto-triage-skipbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedpkg:typesapplies to `@slack/types`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions