From 74f371cc7926ed3a67ec8611df449474481e0deb Mon Sep 17 00:00:00 2001 From: Waleed Date: Tue, 6 Jan 2026 15:01:55 -0800 Subject: [PATCH] fix(build): fix type assertion (#2696) * fix(build): fix type assertion * ack PR comment * more --- apps/sim/tools/http/request.ts | 8 ++++---- apps/sim/tools/http/webhook_request.ts | 2 +- apps/sim/tools/types.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/sim/tools/http/request.ts b/apps/sim/tools/http/request.ts index dfb26dd24d..db47883f50 100644 --- a/apps/sim/tools/http/request.ts +++ b/apps/sim/tools/http/request.ts @@ -70,7 +70,7 @@ export const requestTool: ToolConfig = { return allHeaders }, - body: (params: RequestParams) => { + body: ((params: RequestParams) => { if (params.formData) { const formData = new FormData() Object.entries(params.formData).forEach(([key, value]) => { @@ -90,7 +90,7 @@ export const requestTool: ToolConfig = { ) { // Convert JSON object to URL-encoded string const urlencoded = new URLSearchParams() - Object.entries(params.body).forEach(([key, value]) => { + Object.entries(params.body as Record).forEach(([key, value]) => { if (value !== undefined && value !== null) { urlencoded.append(key, String(value)) } @@ -98,11 +98,11 @@ export const requestTool: ToolConfig = { return urlencoded.toString() } - return params.body + return params.body as Record } return undefined - }, + }) as (params: RequestParams) => Record | string | FormData | undefined, }, transformResponse: async (response: Response) => { diff --git a/apps/sim/tools/http/webhook_request.ts b/apps/sim/tools/http/webhook_request.ts index b873a939b7..f04da4c1f8 100644 --- a/apps/sim/tools/http/webhook_request.ts +++ b/apps/sim/tools/http/webhook_request.ts @@ -68,7 +68,7 @@ export const webhookRequestTool: ToolConfig params.body, + body: (params: WebhookRequestParams) => params.body as Record, }, transformResponse: async (response: Response) => { diff --git a/apps/sim/tools/types.ts b/apps/sim/tools/types.ts index 324f254e09..36f7cf366a 100644 --- a/apps/sim/tools/types.ts +++ b/apps/sim/tools/types.ts @@ -93,7 +93,7 @@ export interface ToolConfig

{ url: string | ((params: P) => string) method: HttpMethod | ((params: P) => HttpMethod) headers: (params: P) => Record - body?: (params: P) => Record | string + body?: (params: P) => Record | string | FormData | undefined } // Post-processing (optional) - allows additional processing after the initial request