-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is code
property not included in RichTextStyleable type?
#1706
Comments
code
property is not included in RichTextStyleable type.code
property not included in RichTextStyleable type.
code
property not included in RichTextStyleable type.code
property not included in RichTextStyleable type?
Hey @AleksaStevic, thanks for the issue, you are totally correct. I just tried in testing, and indeed you can set Also, in case it is helpful: the preformatted code blocks do work and are typed, see: https://github.com/slackapi/node-slack-sdk/blob/main/packages/types/src/block-kit/block-elements.ts#L952 I will try to whip up a PR to address this issue. |
This is a specific use case where I need inline code to be typed correctly. I can't use preformatted. I can create a quick PR to fix this if you want. |
…ight` property (it did nothing, anyways). Fixes #1706
@AleksaStevic I created #1707 to address this, I will try to make a new release of Are you using the types via any other of the node SDKs? Like |
@filmaj Yes, @slack/bolt re-exports all types from "@slack/types" and I am using that, also, Bolt functions are typed using @slack/types. So it's required to upgrade the @slack/types dependency in @slack/bolt when version @slack/types is released with this fix. If that's not possible, I suppose I could use something like overrides or resolutions in package.json to override the dependency version. |
It's fine, just making sure so I know which packages to include the updates to. As soon as I can get a review on #1707 I will release all three: types, web-api and bolt. |
Going to start the release process, I'll post here once the new versions are up. |
Happy holidays! |
Rich text section can contain a list of rich text elements. The most common is element of type
text
- RichTextText type. We can addstyle
property to this element to change the appearance of the text: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 theRichTextStyleable
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
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:
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 inRichTextStyleable['style']
, but should be.The text was updated successfully, but these errors were encountered: