Skip to content

Commit 74f371c

Browse files
authored
fix(build): fix type assertion (#2696)
* fix(build): fix type assertion * ack PR comment * more
1 parent d248557 commit 74f371c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

apps/sim/tools/http/request.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const requestTool: ToolConfig<RequestParams, RequestResponse> = {
7070
return allHeaders
7171
},
7272

73-
body: (params: RequestParams) => {
73+
body: ((params: RequestParams) => {
7474
if (params.formData) {
7575
const formData = new FormData()
7676
Object.entries(params.formData).forEach(([key, value]) => {
@@ -90,19 +90,19 @@ export const requestTool: ToolConfig<RequestParams, RequestResponse> = {
9090
) {
9191
// Convert JSON object to URL-encoded string
9292
const urlencoded = new URLSearchParams()
93-
Object.entries(params.body).forEach(([key, value]) => {
93+
Object.entries(params.body as Record<string, unknown>).forEach(([key, value]) => {
9494
if (value !== undefined && value !== null) {
9595
urlencoded.append(key, String(value))
9696
}
9797
})
9898
return urlencoded.toString()
9999
}
100100

101-
return params.body
101+
return params.body as Record<string, any>
102102
}
103103

104104
return undefined
105-
},
105+
}) as (params: RequestParams) => Record<string, any> | string | FormData | undefined,
106106
},
107107

108108
transformResponse: async (response: Response) => {

apps/sim/tools/http/webhook_request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const webhookRequestTool: ToolConfig<WebhookRequestParams, RequestRespons
6868
return { ...webhookHeaders, ...userHeaders }
6969
},
7070

71-
body: (params: WebhookRequestParams) => params.body,
71+
body: (params: WebhookRequestParams) => params.body as Record<string, any>,
7272
},
7373

7474
transformResponse: async (response: Response) => {

apps/sim/tools/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export interface ToolConfig<P = any, R = any> {
9393
url: string | ((params: P) => string)
9494
method: HttpMethod | ((params: P) => HttpMethod)
9595
headers: (params: P) => Record<string, string>
96-
body?: (params: P) => Record<string, any> | string
96+
body?: (params: P) => Record<string, any> | string | FormData | undefined
9797
}
9898

9999
// Post-processing (optional) - allows additional processing after the initial request

0 commit comments

Comments
 (0)