Skip to content

Commit

Permalink
Merge branch 'master' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Jun 22, 2020
2 parents 007b9b4 + 4a37d1b commit 887598c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -104,6 +104,7 @@ A big thanks to both [Draqula](https://github.com/vadimdemedes/draqula) for insp
- [Amazon](https://amazon.com)
- [Microsoft](https://microsoft.com)
- [Target](https://target.com)
- [CarFAX](https://carfax.com)
- [HP](https://hp.com)
- [Major League Baseball Association](https://www.mlb.com)
- [Volvo](https://www.volvocars.com)
Expand Down
16 changes: 11 additions & 5 deletions types/index.d.ts
Expand Up @@ -357,6 +357,10 @@ export interface PrefetchQueryOptions<TResult, TError = Error>
throwOnError?: boolean
}

export interface SetQueryDataQueryOptions<TResult, TError = Error> extends QueryOptions<TResult, TError> {
exact?: boolean
}

export interface InfiniteQueryOptions<TResult, TMoreVariable, TError = Error>
extends QueryOptions<TResult[], TError> {
getFetchMore: (
Expand Down Expand Up @@ -462,15 +466,16 @@ export interface InfiniteQueryResult<TResult, TMoreVariable, TError = Error>
}

export function useMutation<TResults, TVariables = undefined, TError = Error>(
mutationFn: MutationFunction<TResults, TVariables>,
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 Expand Up @@ -626,9 +631,10 @@ export interface QueryCache {
}): Promise<TResult>

getQueryData<T = unknown>(key: AnyQueryKey | string): T | undefined
setQueryData<T = unknown>(
setQueryData<TResult, TError>(
key: AnyQueryKey | string,
dataOrUpdater: T | undefined | ((oldData: T | undefined) => T | undefined)
dataOrUpdater: TResult | undefined | ((oldData: TResult | undefined) => TResult | undefined),
config?: SetQueryDataQueryOptions<TResult, TError>
): void
invalidateQueries<TResult>(
queryKeyOrPredicateFn:
Expand Down

0 comments on commit 887598c

Please sign in to comment.