Updated fetch type

This commit is contained in:
Luis Alvarez 2021-05-28 11:50:33 -05:00
parent 3b74f8d854
commit 874cf9d5b3
2 changed files with 5 additions and 2 deletions

View File

@ -107,7 +107,7 @@ export type GetCartHook<T extends CartTypes = CartTypes> = {
export type AddItemHook<T extends CartTypes = CartTypes> = { export type AddItemHook<T extends CartTypes = CartTypes> = {
data: T['cart'] data: T['cart']
input: T['itemBody'] input?: T['itemBody']
fetcherInput: T['itemBody'] fetcherInput: T['itemBody']
body: { item: T['itemBody'] } body: { item: T['itemBody'] }
actionInput: T['itemBody'] actionInput: T['itemBody']

View File

@ -43,7 +43,10 @@ export type HookFetcherFn<H extends HookSchemaBase> = (
export type HookFetcherContext<H extends HookSchemaBase> = { export type HookFetcherContext<H extends HookSchemaBase> = {
options: HookFetcherOptions options: HookFetcherOptions
input: H['fetcherInput'] input: H['fetcherInput']
fetch: <T = H['fetchData'], B = H['body']>( fetch: <
T = H['fetchData'] extends {} | null ? H['fetchData'] : any,
B = H['body']
>(
options: FetcherOptions<B> options: FetcherOptions<B>
) => Promise<T> ) => Promise<T>
} }