Comprehensive TypeScript type definitions for building Slack applications and integrations with the Node Slack SDK
94
Build a Slack message formatter that creates an image gallery display. The formatter should accept a list of images with their metadata and create a properly structured Slack message that displays these images with context.
Your implementation must:
Accept an array of image objects, where each object contains:
Create a Slack message that displays each image with its metadata. The message should:
Return a valid Slack message structure that can be sent via the Slack API
Create a TypeScript module with the following:
src/image-gallery.ts file containing:
Implement the following test cases in src/image-gallery.test.ts:
Given an array with one image (URL: "https://example.com/photo.jpg", alt text: "A beautiful sunset"), the function should return a valid Slack message structure that displays this image.
Given an array with three images, each having a URL, alt text, and title, the function should return a Slack message that displays all three images with their titles and maintains clear visual separation between them.
Given an image with only URL and alt text (no title), the function should create a valid display that includes the image with its alt text but gracefully handles the missing title.
Provides TypeScript type definitions for Slack message structures and Block Kit components.
src/image-gallery.ts - Main implementationsrc/image-gallery.test.ts - Test suitepackage.json - Project configuration with @slack/types dependencyInstall with Tessl CLI
npx tessl i tessl/npm-slack--typesdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10