From cb2946ddcafbeedecf724aa19b3929865c026bc7 Mon Sep 17 00:00:00 2001 From: Leo McArdle Date: Sat, 11 May 2024 12:46:18 +0100 Subject: [PATCH] fix(infinte): export SWRInfiniteKeyedMutator type (#2900) * fix(types): export InfiniteKeyedMutator * type(infinite): expose SWRInfiniteKeyedMutator type --------- Co-authored-by: Toru Kobayashi --- src/infinite/index.ts | 2 ++ src/infinite/types.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/infinite/index.ts b/src/infinite/index.ts index 0bdc556d0..f410b5bef 100644 --- a/src/infinite/index.ts +++ b/src/infinite/index.ts @@ -31,6 +31,7 @@ import type { SWRInfiniteFetcher, SWRInfiniteCacheValue, SWRInfiniteCompareFn, + SWRInfiniteKeyedMutator, SWRInfiniteMutatorOptions } from './types' import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js' @@ -359,5 +360,6 @@ export { SWRInfiniteKeyLoader, SWRInfiniteFetcher, SWRInfiniteCompareFn, + SWRInfiniteKeyedMutator, SWRInfiniteMutatorOptions } diff --git a/src/infinite/types.ts b/src/infinite/types.ts index b9c58283a..4237b6aba 100644 --- a/src/infinite/types.ts +++ b/src/infinite/types.ts @@ -47,7 +47,7 @@ interface SWRInfiniteRevalidateFn { (data: Data, key: Arguments): boolean } -type InfiniteKeyedMutator = ( +export type SWRInfiniteKeyedMutator = ( data?: Data | Promise | MutatorCallback, opts?: boolean | SWRInfiniteMutatorOptions ) => Promise @@ -65,7 +65,7 @@ export interface SWRInfiniteResponse setSize: ( size: number | ((_size: number) => number) ) => Promise - mutate: InfiniteKeyedMutator + mutate: SWRInfiniteKeyedMutator } export interface SWRInfiniteHook {