Open
Description
Describe the bug.
The postReplyInThread
method in netlify/functions/save-discussion-background/Slack.ts
has a TypeScript error due to incompatible types in the Slack Web API call:
Argument of type '{ channel: string; text: string; as_user: true; thread_ts: string; icon_url: string; }' is not assignable to parameter of type 'ChatPostMessageArguments'.
Types of property 'icon_url' are incompatible.
Type 'string' is not assignable to type 'undefined'.
Current Behavior
- When posting a reply in a Slack thread, we're trying to set both
as_user: true
andicon_url
- This causes a type error because when posting as a user (
as_user: true
), Slack automatically uses the user's profile picture - The code currently attempts to override this with a custom icon URL, which is not allowed by the API
Expected behavior
- Messages should be posted as the authenticated user with their profile picture
- No type errors in the TypeScript compilation
Screenshots
How to Reproduce
View Error:
# Run TypeScript check on the specific file
npx tsc netlify/functions/save-discussion-background/Slack.ts --noEmit
The type error will appear:
Error: Argument of type '{ channel: string; text: string; as_user: true; thread_ts: string; icon_url: string; }' is not assignable to parameter of type 'ChatPostMessageArguments'.
Types of property 'icon_url' are incompatible.
Type 'string' is not assignable to type 'never'.
🥦 Browser
None
👀 Have you checked for similar open issues?
- I checked and didn't find similar issue
🏢 Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to work on this issue ?
Yes I am willing to submit a PR!