Package
@slack/types
SDK Version
@slack/types 2.21.1
Node.js Version
v24.12.0
Operating System
No response
Steps to Reproduce
SlackListsItemFieldMessage in packages/web-api/src/types/request/slackLists.ts defines:
export interface SlackListsItemFieldMessage {
column_id: string;
message: string[];
}
The Slack API can return the message field as either:
- A single message object:
"message": {"text":"hello", "ts": "123.456"}
- An array of message objects:
"message":[{"text": "a"}, {"text":"b"}]
The current typing is inaccurate in two ways:
- It assumes
message is always an array, but the API may return a single object
- It types elements as
string when they areactually message objects
See java-slack-sdk#1587 for the same API inconsistency on the Java side.
Suggested fix
interface SlackListsItemMessage {
text?: string;
ts?: string;
user?: string;
team?: string;
type?: string;
}
export interface SlackListsItemFieldMessage {
column_id: string;
message: SlackListsItemMessage | SlackListsItemMessage[];
}
export interface SlackListsItemFieldMessage {
column_id: string;
message: SlackListsItemMessage | SlackListsItemMessage[];
}
This types it as a union so consumers handle both shapes.
Impact
No runtime crash (JavaScript is untyped at runtime), but developers relying on the type will write incorrect code, like calling .map() on a non-array or treating objects as strings.
References
Expected Result
N/A
Actual Result
N/A
Package
@slack/types
SDK Version
@slack/types 2.21.1
Node.js Version
v24.12.0
Operating System
No response
Steps to Reproduce
SlackListsItemFieldMessageinpackages/web-api/src/types/request/slackLists.tsdefines:The Slack API can return the message field as either:
"message": {"text":"hello", "ts": "123.456"}"message":[{"text": "a"}, {"text":"b"}]The current typing is inaccurate in two ways:
messageis always an array, but the API may return a single objectstringwhen they areactually message objectsSee java-slack-sdk#1587 for the same API inconsistency on the Java side.
Suggested fix
This types it as a union so consumers handle both shapes.
Impact
No runtime crash (JavaScript is untyped at runtime), but developers relying on the type will write incorrect code, like calling .map() on a non-array or treating objects as strings.
References
Expected Result
N/A
Actual Result
N/A