-
Notifications
You must be signed in to change notification settings - Fork 676
Description
Rich text section can contain a list of rich text elements. The most common is element of type text - RichTextText type. We can add style property to this element to change the appearance of the text:
style?: {
bold?: boolean;
italic?: boolean;
strike?: boolean;
highlight?: boolean;
};In the documentation and block editor, it is allowed to add code property to style to make the text appear as inline code, although in the RichTextStyleable type it is excluded, and there is a comment that it is excluded but I don't know why:
https://github.com/slackapi/node-slack-sdk/blob/main/packages/types/src/block-kit/extensions.ts#L56
Packages:
Select all that apply:
-
@slack/web-api -
@slack/rtm-api -
@slack/webhooks -
@slack/oauth -
@slack/socket-mode -
@slack/types - I don't know
Reproducible in:
The Slack SDK version
"slack/bolt": "^3.16.0",
"slack/web-api": "^6.10.0",
"@slack/bolt" has a dependency: "@slack/types": "^2.9.0" that is used for typings.
Node.js runtime version
v20.10.0
OS info
ProductName: macOS
ProductVersion: 14.2
BuildVersion: 23C64
Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020
Steps to reproduce:
(Share the commands to run, source code, and project settings)
Using @slack/bolt, in any message handler add this code:
- tsconfig.json compiler options:
"strict": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noImplicitThis": true,
"allowSyntheticDefaultImports": true
- Example code in plain @slack/bolt project:
const msg = await say({
text: 'Searching for answers...',
blocks: [
{
type: 'rich_text',
elements: [
{
type: 'rich_text_section',
elements: [
{
type: 'text',
text: 'Hello, I should be a code',
style: {
code: true,
},
},
],
},
],
},
],
})- run
tsc --noEmit --skipLibcheck
Expected result:
No type issues.
Actual result:
TS error: Type '{ type: "text"; text: string; style: { code: true; }; }' is not assignable to type 'RichTextElement'
I also get red lines in the editor immediately.
The issue is that code property is not included in RichTextStyleable['style'], but should be.