fix(build): fix type assertion (#2696)

* fix(build): fix type assertion

* ack PR comment

* more
This commit is contained in:
Waleed
2026-01-06 15:01:55 -08:00
committed by GitHub
parent d248557042
commit 74f371cc79
3 changed files with 6 additions and 6 deletions

View File

@@ -70,7 +70,7 @@ export const requestTool: ToolConfig<RequestParams, RequestResponse> = {
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<RequestParams, RequestResponse> = {
) {
// Convert JSON object to URL-encoded string
const urlencoded = new URLSearchParams()
Object.entries(params.body).forEach(([key, value]) => {
Object.entries(params.body as Record<string, unknown>).forEach(([key, value]) => {
if (value !== undefined && value !== null) {
urlencoded.append(key, String(value))
}
@@ -98,11 +98,11 @@ export const requestTool: ToolConfig<RequestParams, RequestResponse> = {
return urlencoded.toString()
}
return params.body
return params.body as Record<string, any>
}
return undefined
},
}) as (params: RequestParams) => Record<string, any> | string | FormData | undefined,
},
transformResponse: async (response: Response) => {

View File

@@ -68,7 +68,7 @@ export const webhookRequestTool: ToolConfig<WebhookRequestParams, RequestRespons
return { ...webhookHeaders, ...userHeaders }
},
body: (params: WebhookRequestParams) => params.body,
body: (params: WebhookRequestParams) => params.body as Record<string, any>,
},
transformResponse: async (response: Response) => {

View File

@@ -93,7 +93,7 @@ export interface ToolConfig<P = any, R = any> {
url: string | ((params: P) => string)
method: HttpMethod | ((params: P) => HttpMethod)
headers: (params: P) => Record<string, string>
body?: (params: P) => Record<string, any> | string
body?: (params: P) => Record<string, any> | string | FormData | undefined
}
// Post-processing (optional) - allows additional processing after the initial request