Skip to content

Commit

Permalink
Revert "fix: fix the type of the argument of KeyedMutator for `popu…
Browse files Browse the repository at this point in the history
…lateCache`"

This reverts commit d2a4282.
  • Loading branch information
Key5n committed Jun 17, 2024
1 parent b4681da commit 89611e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
7 changes: 2 additions & 5 deletions src/_internal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,9 @@ export interface ScopedMutator {
* @typeParam MutationData - The type of the data returned by the mutator
*/
export type KeyedMutator<Data> = <MutationData = Data>(
data?:
| MutationData
| Promise<MutationData | undefined>
| MutatorCallback<MutationData>,
data?: Data | Promise<Data | undefined> | MutatorCallback<Data>,
opts?: boolean | MutatorOptions<Data, MutationData>
) => Promise<MutationData | undefined>
) => Promise<Data | MutationData | undefined>

export type SWRConfiguration<
Data = any,
Expand Down
11 changes: 6 additions & 5 deletions src/infinite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,13 @@ export const infinite = (<Data, Error>(useSWRNext: SWRHook) =>

const mutate = useCallback(
// eslint-disable-next-line func-names
function <MutationData = Data[]>(
function <T = Data[]>(
data?:
| MutationData
| Promise<MutationData | undefined>
| MutatorCallback<MutationData>,
opts?: boolean | SWRInfiniteMutatorOptions<Data[], MutationData>
| undefined
| Data[]
| Promise<Data[] | undefined>
| MutatorCallback<Data[]>,
opts?: undefined | boolean | SWRInfiniteMutatorOptions<Data[], T>
) {
// When passing as a boolean, it's explicitly used to disable/enable
// revalidation.
Expand Down

0 comments on commit 89611e3

Please sign in to comment.