diff --git a/framework/commerce/types/cart.ts b/framework/commerce/types/cart.ts index 4cd9d13da..e27374d98 100644 --- a/framework/commerce/types/cart.ts +++ b/framework/commerce/types/cart.ts @@ -107,7 +107,7 @@ export type GetCartHook = { export type AddItemHook = { data: T['cart'] - input: T['itemBody'] + input?: T['itemBody'] fetcherInput: T['itemBody'] body: { item: T['itemBody'] } actionInput: T['itemBody'] diff --git a/framework/commerce/utils/types.ts b/framework/commerce/utils/types.ts index fe1507d08..751cea4a5 100644 --- a/framework/commerce/utils/types.ts +++ b/framework/commerce/utils/types.ts @@ -43,7 +43,10 @@ export type HookFetcherFn = ( export type HookFetcherContext = { options: HookFetcherOptions input: H['fetcherInput'] - fetch: ( + fetch: < + T = H['fetchData'] extends {} | null ? H['fetchData'] : any, + B = H['body'] + >( options: FetcherOptions ) => Promise }