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.