Skip to content

Commit 36dd40e

Browse files
committed
fix(plugin-slack): drop unnecessary as-unknown cast on user WebClient — Greptile P2
`WebClient` in this file is aliased to `App["client"]` (line 26), which is the same `@slack/web-api` `WebClient` class imported here as `SlackWebClient`. The two types are structurally identical, so the double `as unknown as WebClient` was masking — not bridging — type compatibility. Drop the `unknown` indirection so any future divergence between the Bolt-wrapped client and the direct import surfaces as a type error at the cast site instead of being silently swallowed. Inline comment expanded to record the invariant for future readers. Verification: - bunx tsc --noEmit -p plugins/plugin-slack/tsconfig.json: clean - bunx vitest run plugins/plugin-slack/src/: 17/17 pass Follow-up to Greptile P2 on PR #7876 (post-merge).
1 parent b19714e commit 36dd40e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

plugins/plugin-slack/src/service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,12 @@ export class SlackService extends Service implements ISlackService {
732732
// session is needed. Only constructed when a user token is
733733
// configured. Routing decisions in getOutboundClient() consult
734734
// account.role to decide which client receives each call.
735+
// `WebClient` is the alias for `App["client"]`, which is the
736+
// same `@slack/web-api` `WebClient` class imported here as
737+
// `SlackWebClient` — a direct `as WebClient` cast is correct
738+
// and a future type divergence will surface as an error here.
735739
const userClient = account.userToken
736-
? (new SlackWebClient(account.userToken) as unknown as WebClient)
740+
? (new SlackWebClient(account.userToken) as WebClient)
737741
: null;
738742

739743
const state: SlackAccountRuntime = {

0 commit comments

Comments
 (0)