From 7e16aad1c4e18ecc6874aa5234cd69aa583928e1 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 8 Sep 2026 18:30:19 -0700 Subject: [PATCH 1/6] fix(types): allow raw_number cells in TableBlock rows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The table-block reference documents that table cells "can have a type of rich_text, raw_text, or raw_number", but TableBlock.rows was typed (RichTextBlock | RawTextElement)[][] — omitting raw_number — and its @description said only "raw_text or rich_text". A valid raw_number table cell (verified in Block Kit Builder) raised a spurious type error. - Add the RawNumberElement composition object (type raw_number, value, text), the same definition the data_table PR (#2638) introduces, so the two share one cell element type. - Add RawNumberElement to TableBlock.rows and correct the @description to match the docs. - Add the first tsd coverage for TableBlock (all three cell types; TableBlock had no type tests before). Closes #2689. Ref: https://docs.slack.dev/reference/block-kit/blocks/table-block Co-Authored-By: Claude --- .changeset/table-raw-number-cell.md | 5 ++++ packages/types/src/block-kit/blocks.ts | 5 ++-- .../src/block-kit/composition-objects.ts | 18 +++++++++++ packages/types/test/blocks.test-d.ts | 30 ++++++++++++++++++- 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .changeset/table-raw-number-cell.md diff --git a/.changeset/table-raw-number-cell.md b/.changeset/table-raw-number-cell.md new file mode 100644 index 000000000..f4fda86df --- /dev/null +++ b/.changeset/table-raw-number-cell.md @@ -0,0 +1,5 @@ +--- +"@slack/types": minor +--- + +fix: allow [`raw_number`](https://docs.slack.dev/reference/block-kit/blocks/table-block) cells in `TableBlock` rows (adds `RawNumberElement`) diff --git a/packages/types/src/block-kit/blocks.ts b/packages/types/src/block-kit/blocks.ts index 60ab5166c..2db7f035c 100644 --- a/packages/types/src/block-kit/blocks.ts +++ b/packages/types/src/block-kit/blocks.ts @@ -28,6 +28,7 @@ import type { import type { MrkdwnElement, PlainTextElement, + RawNumberElement, RawTextElement, SlackFileImageObject, TextObject, @@ -520,9 +521,9 @@ export interface TableBlock extends Block { */ type: 'table'; /** - * @description An array consisting of table rows. Maximum 100 rows. Each row object is an array with a max of 20 table cells. Table cells can have a type of raw_text or rich_text. + * @description An array consisting of table rows. Maximum 100 rows. Each row object is an array with a max of 20 table cells. Table cells can have a type of raw_text, raw_number, or rich_text. */ - rows: (RichTextBlock | RawTextElement)[][]; + rows: (RichTextBlock | RawTextElement | RawNumberElement)[][]; /** * @description An array describing column behavior. If there are fewer items in the column_settings array than there are columns in the table, then the items in the the column_settings array will describe the same number of columns in the table as there are in the array itself. Any additional columns will have the default behavior. Maximum 20 items. */ diff --git a/packages/types/src/block-kit/composition-objects.ts b/packages/types/src/block-kit/composition-objects.ts index 886830344..b36d1cf50 100644 --- a/packages/types/src/block-kit/composition-objects.ts +++ b/packages/types/src/block-kit/composition-objects.ts @@ -173,6 +173,24 @@ export interface MrkdwnElement { verbatim?: boolean; } +/** + * @description Defines an object containing a numeric value. + */ +export interface RawNumberElement { + /** + * @description The formatting to use for this numeric object. + */ + type: 'raw_number'; + /** + * @description The numeric value. + */ + value: number; + /** + * @description The text used to display the value. The minimum length is 1 character. + */ + text: string; +} + /** * @description Defines an object containing some text. * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. diff --git a/packages/types/test/blocks.test-d.ts b/packages/types/test/blocks.test-d.ts index 3169703e5..8d1028def 100644 --- a/packages/types/test/blocks.test-d.ts +++ b/packages/types/test/blocks.test-d.ts @@ -1,5 +1,5 @@ import { expectAssignable, expectError } from 'tsd'; -import type { AlertBlock, CardBlock, CarouselBlock, ContainerBlock, KnownBlock } from '../src/index'; +import type { AlertBlock, CardBlock, CarouselBlock, ContainerBlock, KnownBlock, TableBlock } from '../src/index'; // CardBlock // -- sad path @@ -102,3 +102,31 @@ expectAssignable({ title: { type: 'plain_text', text: 'Known' }, child_blocks: [{ type: 'divider' }], }); + +// TableBlock +// -- sad path +expectError({}); // missing type and rows +expectError({ type: 'table' }); // missing required rows +// -- happy path +// Table cells can be raw_text, raw_number, or rich_text. +expectAssignable({ + type: 'table', + rows: [ + [ + { type: 'raw_text', text: 'Item' }, + { type: 'raw_text', text: 'Count' }, + ], + [ + { type: 'raw_text', text: 'Widgets' }, + { type: 'raw_number', value: 42, text: '42' }, + ], + [ + { type: 'rich_text', elements: [{ type: 'rich_text_section', elements: [{ type: 'text', text: 'Gadgets' }] }] }, + { type: 'raw_number', value: 7, text: '7' }, + ], + ], +}); +expectAssignable({ + type: 'table', + rows: [[{ type: 'raw_number', value: 1, text: '1' }]], +}); From 9f0d08e726a368b05e11ae84ed664d90e7fc3049 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 8 Sep 2026 18:45:08 -0700 Subject: [PATCH 2/6] docs(types): match TableBlock.rows cell order to the docs The docs list the cell types as "rich_text, raw_text, or raw_number"; align the @description (and the test comment) to that order verbatim. Co-Authored-By: Claude --- packages/types/src/block-kit/blocks.ts | 2 +- packages/types/test/blocks.test-d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/types/src/block-kit/blocks.ts b/packages/types/src/block-kit/blocks.ts index 2db7f035c..540b0c473 100644 --- a/packages/types/src/block-kit/blocks.ts +++ b/packages/types/src/block-kit/blocks.ts @@ -521,7 +521,7 @@ export interface TableBlock extends Block { */ type: 'table'; /** - * @description An array consisting of table rows. Maximum 100 rows. Each row object is an array with a max of 20 table cells. Table cells can have a type of raw_text, raw_number, or rich_text. + * @description An array consisting of table rows. Maximum 100 rows. Each row object is an array with a max of 20 table cells. Table cells can have a type of rich_text, raw_text, or raw_number. */ rows: (RichTextBlock | RawTextElement | RawNumberElement)[][]; /** diff --git a/packages/types/test/blocks.test-d.ts b/packages/types/test/blocks.test-d.ts index 8d1028def..88ac0f8a3 100644 --- a/packages/types/test/blocks.test-d.ts +++ b/packages/types/test/blocks.test-d.ts @@ -108,7 +108,7 @@ expectAssignable({ expectError({}); // missing type and rows expectError({ type: 'table' }); // missing required rows // -- happy path -// Table cells can be raw_text, raw_number, or rich_text. +// Table cells can be rich_text, raw_text, or raw_number. expectAssignable({ type: 'table', rows: [ From aaee94ead7235fdc24589c5e2e110ef530b5d3bd Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 8 Sep 2026 18:48:18 -0700 Subject: [PATCH 3/6] docs(changeset): move the table-block link onto TableBlock The doc link points at the table-block reference, so wrap it around `TableBlock` rather than `raw_number`. Co-Authored-By: Claude --- .changeset/table-raw-number-cell.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/table-raw-number-cell.md b/.changeset/table-raw-number-cell.md index f4fda86df..121d2d2ab 100644 --- a/.changeset/table-raw-number-cell.md +++ b/.changeset/table-raw-number-cell.md @@ -2,4 +2,4 @@ "@slack/types": minor --- -fix: allow [`raw_number`](https://docs.slack.dev/reference/block-kit/blocks/table-block) cells in `TableBlock` rows (adds `RawNumberElement`) +fix: allow `raw_number` cells in [`TableBlock`](https://docs.slack.dev/reference/block-kit/blocks/table-block) rows (adds `RawNumberElement`) From 8755f7f544b00c44efc5b529601e4051ea11b1bb Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 8 Sep 2026 18:50:18 -0700 Subject: [PATCH 4/6] chore(changeset): mark the table raw_number change as feat It's an additive minor bump (new RawNumberElement + widened cell union), so the changeset verb should be feat, not fix. Co-Authored-By: Claude --- .changeset/table-raw-number-cell.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/table-raw-number-cell.md b/.changeset/table-raw-number-cell.md index 121d2d2ab..e59e3d0fe 100644 --- a/.changeset/table-raw-number-cell.md +++ b/.changeset/table-raw-number-cell.md @@ -2,4 +2,4 @@ "@slack/types": minor --- -fix: allow `raw_number` cells in [`TableBlock`](https://docs.slack.dev/reference/block-kit/blocks/table-block) rows (adds `RawNumberElement`) +feat: allow `raw_number` cells in [`TableBlock`](https://docs.slack.dev/reference/block-kit/blocks/table-block) rows (adds `RawNumberElement`) From c05c9f78a73fb28a99a2766ad615a214cedc9820 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 8 Sep 2026 18:57:11 -0700 Subject: [PATCH 5/6] test(types): add tsd coverage for RawNumberElement and RawTextElement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new RawNumberElement (and the pre-existing RawTextElement) had no direct type coverage — only indirect exercise through TableBlock. Add a composition-objects.test-d.ts with happy/sad-path cases for both raw cell objects. Placed flat in test/ to match blocks.test-d.ts and block-elements.test-d.ts (test/ mirrors src/ only for the events group). Co-Authored-By: Claude --- .../types/test/composition-objects.test-d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 packages/types/test/composition-objects.test-d.ts diff --git a/packages/types/test/composition-objects.test-d.ts b/packages/types/test/composition-objects.test-d.ts new file mode 100644 index 000000000..98a03259b --- /dev/null +++ b/packages/types/test/composition-objects.test-d.ts @@ -0,0 +1,19 @@ +import { expectAssignable, expectError } from 'tsd'; +import type { RawNumberElement, RawTextElement } from '../src/index'; + +// RawNumberElement +// -- sad path +expectError({}); // missing type, value, and text +expectError({ type: 'raw_number' }); // missing required value and text +expectError({ type: 'raw_number', value: 42 }); // missing required text +expectError({ type: 'raw_number', text: '42' }); // missing required value +expectError({ type: 'raw_number', value: '42', text: '42' }); // value must be a number +// -- happy path +expectAssignable({ type: 'raw_number', value: 42, text: '42' }); + +// RawTextElement +// -- sad path +expectError({}); // missing type and text +expectError({ type: 'raw_text' }); // missing required text +// -- happy path +expectAssignable({ type: 'raw_text', text: 'Item' }); From 3fd2669cc035ede5ce702834063fb322f3d2bd7d Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 9 Sep 2026 16:07:35 -0700 Subject: [PATCH 6/6] test(types): cover column_settings in the TableBlock assertion Extend the TableBlock happy-path assertion to include a column_settings array (is_wrapped and align), giving TableBlockColumnSettings its first type coverage alongside the raw_number cell cases. Co-Authored-By: Claude --- packages/types/test/blocks.test-d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/types/test/blocks.test-d.ts b/packages/types/test/blocks.test-d.ts index 68eb65459..59de4897d 100644 --- a/packages/types/test/blocks.test-d.ts +++ b/packages/types/test/blocks.test-d.ts @@ -166,9 +166,10 @@ expectAssignable({ expectError({}); // missing type and rows expectError({ type: 'table' }); // missing required rows // -- happy path -// Table cells can be rich_text, raw_text, or raw_number. +// Table cells can be rich_text, raw_text, or raw_number; column_settings describe column behavior. expectAssignable({ type: 'table', + column_settings: [{ is_wrapped: true }, { align: 'right' }], rows: [ [ { type: 'raw_text', text: 'Item' },