Skip to content

feat(types): allow raw_number cells in TableBlock rows - #2737

Open
zimeg wants to merge 7 commits into
mainfrom
table-raw-number-cell
Open

feat(types): allow raw_number cells in TableBlock rows#2737
zimeg wants to merge 7 commits into
mainfrom
table-raw-number-cell

Conversation

@zimeg

@zimeg zimeg commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

This pull request fixes the TableBlock type in @slack/types to allow raw_number cells, which the table-block reference documents but the type omitted.

  • The docs state table cells "can have a type of rich_text, raw_text, or raw_number", but TableBlock.rows was typed (RichTextBlock | RawTextElement)[][] (no raw_number) and its @description said only "raw_text or rich_text".
  • Adds the RawNumberElement composition object (type: 'raw_number', value, text) — the same definition introduced by the data_table PR feat(types): add data_table Block Kit block #2638, so the two share one cell element type and whichever lands second drops the duplicate in a trivial merge.
  • Adds RawNumberElement to TableBlock.rows and corrects the @description to match the docs.
  • Adds the first tsd type coverage for TableBlock (all three cell types); TableBlock previously had no type tests.

Closes #2689. A working raw_number-in-table payload is in this Block Kit Builder preview (from the issue).

Requirements

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 <svc-devxp-claude@slack-corp.com>
@changeset-bot

changeset-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3fd2669

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@slack/types Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@zimeg zimeg added pkg:types applies to `@slack/types` semver:minor bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented labels Sep 9, 2026
@zimeg zimeg self-assigned this Sep 9, 2026
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.12%. Comparing base (abf184e) to head (3fd2669).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2737   +/-   ##
=======================================
  Coverage   89.12%   89.12%           
=======================================
  Files          65       65           
  Lines       10441    10441           
  Branches      482      482           
=======================================
  Hits         9306     9306           
  Misses       1103     1103           
  Partials       32       32           
Flag Coverage Δ
cli-hooks 89.12% <ø> (ø)
cli-test 89.12% <ø> (ø)
logger 89.12% <ø> (ø)
oauth 89.12% <ø> (ø)
socket-mode 89.12% <ø> (ø)
web-api 89.12% <ø> (ø)
webhook 89.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

zimeg and others added 3 commits September 8, 2026 18:45
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 <svc-devxp-claude@slack-corp.com>
The doc link points at the table-block reference, so wrap it around
`TableBlock` rather than `raw_number`.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
It's an additive minor bump (new RawNumberElement + widened cell
union), so the changeset verb should be feat, not fix.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg changed the title fix(types): allow raw_number cells in TableBlock rows feat(types): allow raw_number cells in TableBlock rows Sep 9, 2026
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 <svc-devxp-claude@slack-corp.com>

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 Immediate ideas with this change are in comments following-

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 note: This path is adjacent to similar files including:

  • blocks.test-d.ts
  • block-elements.test-d.ts

And I think we might move these to a separate path similar to how "events" are grouped in a follow up PR!

Comment on lines +176 to +192
/**
* @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;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎁 note: Right now this is used for table but #2638 hopes to include this for possible rows too:

🔗 https://docs.slack.dev/reference/block-kit/blocks/data-table-block#schema-raw-number

zimeg and others added 2 commits September 9, 2026 16:02
# Conflicts:
#	packages/types/test/blocks.test-d.ts
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 <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg marked this pull request as ready for review September 10, 2026 01:00
@zimeg
zimeg requested a review from a team as a code owner September 10, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:types applies to `@slack/types` semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TableBlock types: add RawNumberElement and consider typed cell/column_settings models

1 participant