From 69a47ab502d0fcf07d7f7ad61e75561daa0739d3 Mon Sep 17 00:00:00 2001 From: Key5n Date: Fri, 14 Jun 2024 20:18:41 +0900 Subject: [PATCH] Revert "fix: fix the type of the argument of `KeyedMutator` for `populateCache`" This reverts commit d2a4282af1300b7043a5dce4d9e8265a1a86b57d. --- src/_internal/types.ts | 7 ++----- src/infinite/index.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/_internal/types.ts b/src/_internal/types.ts index 7a85047a2..f3cdba5ed 100644 --- a/src/_internal/types.ts +++ b/src/_internal/types.ts @@ -440,12 +440,9 @@ export interface ScopedMutator { * @typeParam MutationData - The type of the data returned by the mutator */ export type KeyedMutator = ( - data?: - | MutationData - | Promise - | MutatorCallback, + data?: Data | Promise | MutatorCallback, opts?: boolean | MutatorOptions -) => Promise +) => Promise export type SWRConfiguration< Data = any, diff --git a/src/infinite/index.ts b/src/infinite/index.ts index 6e51f8574..f410b5bef 100644 --- a/src/infinite/index.ts +++ b/src/infinite/index.ts @@ -240,12 +240,13 @@ export const infinite = ((useSWRNext: SWRHook) => const mutate = useCallback( // eslint-disable-next-line func-names - function ( + function ( data?: - | MutationData - | Promise - | MutatorCallback, - opts?: boolean | SWRInfiniteMutatorOptions + | undefined + | Data[] + | Promise + | MutatorCallback, + opts?: undefined | boolean | SWRInfiniteMutatorOptions ) { // When passing as a boolean, it's explicitly used to disable/enable // revalidation.