CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-slack--types

Comprehensive TypeScript type definitions for building Slack applications and integrations with the Node Slack SDK

94

1.11x
Overview
Eval results
Files

task.mdevals/scenario-2/

Slack Message Formatter

Build a TypeScript utility that creates formatted Slack messages with visual sections separated by dividers.

Overview

Your task is to create a utility function that generates properly typed Slack Block Kit messages. The messages should display multiple content sections separated by visual dividers for improved readability.

Requirements

Create a function buildSectionedMessage that:

  • Accepts an array of section objects, where each section has a title (string) and content (string)
  • Returns an array of Block Kit blocks that alternates between section blocks and divider blocks
  • Uses proper TypeScript types from the @slack/types package
  • Does not add a divider after the last section

Each section should be rendered as a Section Block with markdown text, followed by a divider (except for the last section).

Test Cases

  • Given sections [{title: "Status", content: "All systems operational"}], returns one section block without any dividers @test
  • Given sections [{title: "Alert", content: "Server down"}, {title: "Details", content: "Database connection lost"}], returns section, divider, section (no trailing divider) @test
  • Given empty sections array [], returns empty array @test

Implementation

@generates

API

interface Section {
  title: string;
  content: string;
}

export function buildSectionedMessage(sections: Section[]): any[];

Dependencies { .dependencies }

@slack/types { .dependency }

Provides TypeScript type definitions for Slack Block Kit structures including blocks, elements, and composition objects.

Install with Tessl CLI

npx tessl i tessl/npm-slack--types

tile.json