feat(types): add Card, Carousel, and Alert block types#2567
Conversation
🦋 Changeset detectedLatest commit: 0450dd2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2567 +/- ##
=======================================
Coverage 87.38% 87.38%
=======================================
Files 62 62
Lines 10256 10256
Branches 415 415
=======================================
Hits 8962 8962
Misses 1273 1273
Partials 21 21
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
@srtaalej Would |
zimeg
left a comment
There was a problem hiding this comment.
@srtaalej LGTM! Thanks for introducing another set of blocks to build with 🧰 ✨
I'm approving now with solid implementations but wonder if we can order these entries within source code and also add a changeset so this can be released soon after 🚀
| * At least one of `hero_image`, `title`, `actions`, or `body` must be provided. | ||
| * @see {@link https://docs.slack.dev/reference/block-kit/blocks/card-block Card block reference}. | ||
| */ | ||
| export interface CardBlock extends Block { |
There was a problem hiding this comment.
🧮 question: Might these be ordered same as the KnownBlock pattern?
|
🛠️ praise: Meant to find a good place to thanks for the code example! |
Summary
CardBlock— a rich display block for structured content (hero image, icon, title, subtitle, body, actions)CarouselBlock— a horizontally scrollable collection of card blocks (1–10 cards)AlertBlock— a prominent notice block with severity levels (default, info, warning, error, success)All three interfaces are added to the
KnownBlockdiscriminated union inblocks.tsand automatically barrel-exported viaindex.ts. Type tests cover happy paths, sad paths, and union assignability.Test plan
Test app.js (sends carousel + cards via chat.postMessage on startup)
Test shortcut handler (opens modal with alert blocks via global shortcut)
tsdtype tests for all three block types (happy + sad paths)KnownBlockunion assignability testsnpm run buildandnpm testpass for@slack/typesCardBlockto SlackCarouselBlockto SlackAlertBlockin Slack (alert blocks are only supported in modal views)🤖 Generated with Claude Code