Skip to content

Commit

Permalink
Add VueApolloSmartQueryOptionsFunction type
Browse files Browse the repository at this point in the history
  • Loading branch information
sgarner committed Sep 4, 2021
1 parent 756e88a commit 93af489
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ export type VueApolloSmartQueryOptions<
error?: VueApolloSmartQueryErrorHandler<TResult, TVariables, TError, TComponent>;
};

export type VueApolloSmartQueryOptionsFunction<TResult, TVariables, TError = ApolloError, TApp extends Vue = Vue> = <
TComponent extends Vue = TApp
>(
options?: Partial<Omit<VueApolloSmartQueryOptions<TResult, TVariables, TError, TComponent>, 'query'>>,
) => VueApolloSmartQueryOptions<TResult, TVariables>;

export function createSmartQueryOptionsFunction<TResult, TVariables, TError = ApolloError, TApp extends Vue = Vue>(
query: DocumentNode,
onError?: ApolloOperationErrorHandlerFunction<TError, TApp>,
): <TComponent extends Vue = TApp>(
options?: Partial<Omit<VueApolloSmartQueryOptions<TResult, TVariables, TError, TComponent>, 'query'>>,
) => VueApolloSmartQueryOptions<TResult, TVariables> {
): VueApolloSmartQueryOptionsFunction<TResult, TVariables, TError, TApp> {
return (options = {}) => {
const defaultErrorHandlerFn: VueApolloSmartQueryErrorHandler<TResult, TVariables, TError, TApp> = (
error: TError,
Expand Down

0 comments on commit 93af489

Please sign in to comment.