From 874cf9d5b3777789436f83c579cb0b6415fcbcd6 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Fri, 28 May 2021 11:50:33 -0500 Subject: [PATCH] Updated fetch type --- framework/commerce/types/cart.ts | 2 +- framework/commerce/utils/types.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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 }