Skip to content

Commit

Permalink
fix(infinte): export SWRInfiniteKeyedMutator type (#2900)
Browse files Browse the repository at this point in the history
* fix(types): export InfiniteKeyedMutator

* type(infinite): expose SWRInfiniteKeyedMutator type

---------

Co-authored-by: Toru Kobayashi <koba0004@gmail.com>
  • Loading branch information
LeoMcA and koba04 committed May 11, 2024
1 parent 2a5000e commit cb2946d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/infinite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import type {
SWRInfiniteFetcher,
SWRInfiniteCacheValue,
SWRInfiniteCompareFn,
SWRInfiniteKeyedMutator,
SWRInfiniteMutatorOptions
} from './types'
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js'
Expand Down Expand Up @@ -359,5 +360,6 @@ export {
SWRInfiniteKeyLoader,
SWRInfiniteFetcher,
SWRInfiniteCompareFn,
SWRInfiniteKeyedMutator,
SWRInfiniteMutatorOptions
}
4 changes: 2 additions & 2 deletions src/infinite/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface SWRInfiniteRevalidateFn<Data = any> {
(data: Data, key: Arguments): boolean
}

type InfiniteKeyedMutator<Data> = <MutationData = Data>(
export type SWRInfiniteKeyedMutator<Data> = <MutationData = Data>(
data?: Data | Promise<Data | undefined> | MutatorCallback<Data>,
opts?: boolean | SWRInfiniteMutatorOptions<Data, MutationData>
) => Promise<Data | MutationData | undefined>
Expand All @@ -65,7 +65,7 @@ export interface SWRInfiniteResponse<Data = any, Error = any>
setSize: (
size: number | ((_size: number) => number)
) => Promise<Data[] | undefined>
mutate: InfiniteKeyedMutator<Data[]>
mutate: SWRInfiniteKeyedMutator<Data[]>
}

export interface SWRInfiniteHook {
Expand Down

0 comments on commit cb2946d

Please sign in to comment.