diff --git a/js/src/singletons/fetch.ts b/js/src/singletons/fetch.ts index 65b30c8d7..27ef19616 100644 --- a/js/src/singletons/fetch.ts +++ b/js/src/singletons/fetch.ts @@ -12,7 +12,7 @@ export const setFetchImplementation = (fetch: (...args: any[]) => any) => { (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch; }; -export const getFetchImplementation = () => { +export const getFetchImplementation: () => (...args: any[]) => any = () => { return ( (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ?? DEFAULT_FETCH_IMPLEMENTATION diff --git a/js/src/utils/async_caller.ts b/js/src/utils/async_caller.ts index a00350718..2771d2239 100644 --- a/js/src/utils/async_caller.ts +++ b/js/src/utils/async_caller.ts @@ -153,8 +153,9 @@ export class AsyncCaller { fetch(...args: Parameters): ReturnType { return this.call(() => - getFetchImplementation()(...args).then((res) => - res.ok ? res : Promise.reject(res) + getFetchImplementation()(...args).then( + (res: Awaited>) => + res.ok ? res : Promise.reject(res) ) ); }