Skip to content

Commit

Permalink
Allow return type specification in IFieldResolver (#968)
Browse files Browse the repository at this point in the history
* Allow return type specification in IFieldResolver

- This adds a fourth parameter to `IFieldResolver`: `TReturn`
- TReturn defaults to `any` for backwards compatibility

* Update changelog

Co-authored-by: Michael Fix <[email protected]>
Co-authored-by: Arda TANRIKULU <[email protected]>
  • Loading branch information
3 people authored Apr 23, 2020
1 parent ab8c5dd commit a50cf53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,12 @@ export interface MergedTypeInfo {
containsSelectionSet: Map<SubschemaConfig, Map<SelectionSetNode, boolean>>;
}

export type IFieldResolver<TSource, TContext, TArgs = Record<string, any>> = (
export type IFieldResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = (
source: TSource,
args: TArgs,
context: TContext,
info: IGraphQLToolsResolveInfo,
) => any;
) => TReturn;

export type ITypedef = (() => Array<ITypedef>) | string | DocumentNode;

Expand Down

0 comments on commit a50cf53

Please sign in to comment.