From 234c663deb4056d5db97698e29165b26c3a5f9dd Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Thu, 5 Nov 2026 12:55:31 -0800 Subject: [PATCH] fix(types): allow mrkdwn descriptions on checkbox and radio button options --- .changeset/types-option-mrkdwn-description.md | 5 ++ .../src/block-kit/composition-objects.ts | 23 ++++-- packages/types/test/block-elements.test-d.ts | 82 ++++++++++++++++++- 3 files changed, 101 insertions(+), 9 deletions(-) create mode 100644 .changeset/types-option-mrkdwn-description.md diff --git a/.changeset/types-option-mrkdwn-description.md b/.changeset/types-option-mrkdwn-description.md new file mode 100644 index 000000000..8d0cae551 --- /dev/null +++ b/.changeset/types-option-mrkdwn-description.md @@ -0,0 +1,5 @@ +--- +"@slack/types": patch +--- + +fix(types): allow `mrkdwn` descriptions on checkbox and radio button [options](https://docs.slack.dev/reference/block-kit/composition-objects/option-object) diff --git a/packages/types/src/block-kit/composition-objects.ts b/packages/types/src/block-kit/composition-objects.ts index b36d1cf50..367f22aec 100644 --- a/packages/types/src/block-kit/composition-objects.ts +++ b/packages/types/src/block-kit/composition-objects.ts @@ -78,19 +78,21 @@ interface OptionDescriptor { * Maximum length for this field is 3000 characters. */ url?: string; - /** - * @description A {@link PlainTextElement} that defines a line of descriptive text shown below the `text` field. - * Maximum length for the `text` within this field is 75 characters. - */ - description?: PlainTextElement; } export interface MrkdwnOption extends OptionDescriptor { /** - * @description A {@link MrkdwnElement} that defines the text shown in the option on the menu. To be used with - * radio buttons and checkboxes. Maximum length for the `text` in this field is 75 characters. + * @description A {@link PlainTextElement} or {@link MrkdwnElement} that defines the text shown in the option on the + * menu. To be used with radio buttons and checkboxes, which can use `mrkdwn` text objects. Maximum length for the + * `text` in this field is 75 characters. + */ + text: PlainTextElement | MrkdwnElement; + /** + * @description A {@link PlainTextElement} or {@link MrkdwnElement} that defines a line of descriptive text shown + * below the `text` field. Checkbox group and radio button group items can also use `mrkdwn` formatting. Maximum + * length for the `text` within this field is 75 characters. */ - text: MrkdwnElement; + description?: PlainTextElement | MrkdwnElement; } export interface PlainTextOption extends OptionDescriptor { @@ -99,6 +101,11 @@ export interface PlainTextOption extends OptionDescriptor { * overflow, select and multi-select menus. Maximum length for the `text` in this field is 75 characters. */ text: PlainTextElement; + /** + * @description A {@link PlainTextElement} that defines a line of descriptive text shown below the `text` field. + * Maximum length for the `text` within this field is 75 characters. + */ + description?: PlainTextElement; } /** diff --git a/packages/types/test/block-elements.test-d.ts b/packages/types/test/block-elements.test-d.ts index 613819e0a..a7a609a9f 100644 --- a/packages/types/test/block-elements.test-d.ts +++ b/packages/types/test/block-elements.test-d.ts @@ -1,5 +1,13 @@ import { expectAssignable, expectError } from 'tsd'; -import type { Button, RichTextInput, WorkflowButton } from '../src/index'; +import type { + Button, + Checkboxes, + Overflow, + RadioButtons, + RichTextInput, + StaticSelect, + WorkflowButton, +} from '../src/index'; // RichTextInput — happy paths expectAssignable({ @@ -56,3 +64,75 @@ expectAssignable