Skip to content

Commit 05ec76b

Browse files
committed
Make result type generic on ApolloOperationErrorHandlerFunction
1 parent 6923ead commit 05ec76b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/error/handleApolloError.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ import { processApolloError } from './processApolloError';
22
import { ApolloOperationContext } from '../types';
33
import { Vue } from 'vue/types/vue';
44
import { ApolloError, ApolloOperationErrorHandlerFunction } from './types';
5-
import { ApolloErrorHandlerResult, ApolloErrorHandlerResultInterface } from './ApolloErrorHandlerResult';
5+
import { ApolloErrorHandlerResult } from './ApolloErrorHandlerResult';
66

77
/**
88
* This is a simple example of an error handler function. You can copy this and implement your own in your application.
99
*/
10-
export const handleApolloError: ApolloOperationErrorHandlerFunction<ApolloError, Vue> = (
11-
error: ApolloError,
12-
app: Vue,
13-
context?: ApolloOperationContext,
14-
): ApolloErrorHandlerResultInterface => {
10+
export const handleApolloError: ApolloOperationErrorHandlerFunction<
11+
ApolloError,
12+
Vue,
13+
ApolloOperationContext,
14+
ApolloErrorHandlerResult
15+
> = (error: ApolloError, app: Vue, context?: ApolloOperationContext): ApolloErrorHandlerResult => {
1516
const { unhandledErrors, handledErrors } = processApolloError(error, {
1617
app,
1718
context,

src/error/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@ export type ApolloOperationErrorHandlerFunction<
8383
TError = BaseApolloError,
8484
TApp extends Vue = Vue,
8585
TContext = ApolloOperationContext,
86-
> = (error: TError, app: TApp, context?: TContext) => ApolloErrorHandlerResultInterface;
86+
TResult = ApolloErrorHandlerResultInterface,
87+
> = (error: TError, app: TApp, context?: TContext) => TResult;

0 commit comments

Comments
 (0)