Skip to content

Commit

Permalink
fix(types): add mutateOptions on MutationFunction (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
fschwalm committed Jun 19, 2020
1 parent 12665c3 commit 1fc7ed0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions types/index.d.ts
Expand Up @@ -339,7 +339,7 @@ export function useInfiniteQuery<
config?: InfiniteQueryOptions<TResult, TMoreVariable, TError>
): InfiniteQueryResult<TResult, TMoreVariable, TError>

export type DefinedQueryKeyPart =
export type DefinedQueryKeyPart =
| string
| object
| boolean
Expand Down Expand Up @@ -509,13 +509,14 @@ export interface InfiniteQueryResult<TResult, TMoreVariable, TError = Error>
) => Promise<TResult[]> | undefined
}

export function useMutation<TResults, TVariables = undefined, TError = Error>(
mutationFn: MutationFunction<TResults, TVariables>,
export function useMutation<TResults, TVariables = undefined, TError = Error>(
mutationFn: MutationFunction<TResults, TVariables, TError>,
mutationOptions?: MutationOptions<TResults, TVariables, TError>
): [MutateFunction<TResults, TVariables, TError>, MutationResult<TResults, TError>]

export type MutationFunction<TResults, TVariables> = (
variables: TVariables
export type MutationFunction<TResults, TVariables, TError = Error> = (
variables: TVariables,
mutateOptions?: MutateOptions<TResults, TVariables, TError>,
) => Promise<TResults>

export interface MutateOptions<TResult, TVariables, TError = Error> {
Expand Down

0 comments on commit 1fc7ed0

Please sign in to comment.