[BUG] Fix Type Error in Slack postReplyInThread Method
- Dominant language
- TypeScript
- Stars
- 716
- Forks
- 1.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 35
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:
```typescript
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` and `icon_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**:
```bash
# Run TypeScript check on the specific file
npx tsc netlify/functions/save-discussion-background/Slack.ts --noEmit
```
The type error will appear:
```typescript
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?
- [x] I checked and didn't find similar issue
### 🏢 Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md)
### Are you willing to work on this issue ?
Yes I am willing to submit a PR!
Contributor guide
Research direction
Open netlify/functions/save-discussion-background/Slack.ts and inspect the postReplyInThread Slack Web API call, then run npx tsc netlify/functions/save-discussion-background/Slack.ts --noEmit to confirm the reported type error. The work is done when the call compiles and replies are still posted as the authenticated user with that user's profile picture.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100