Skip to content

Commit

Permalink
Merge pull request #1389 from dotansimha/fix/iresolvers-index-signature
Browse files Browse the repository at this point in the history
Fix IResolvers index signature
  • Loading branch information
dotansimha authored Mar 4, 2019
2 parents edb3d7f + 69f4329 commit ca269f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions dev-test/test-schema/resolvers-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,11 @@ export interface DeprecatedDirectiveArgs {
reason?: string;
}



export type IResolvers<TContext = {}> = {
QueryRoot?: QueryRootResolvers.Resolvers<TContext>;
User?: UserResolvers.Resolvers<TContext>;
SubscriptionRoot?: SubscriptionRootResolvers.Resolvers<TContext>;
} & { [typeName: string] : never };
} & { [typeName: string] : { [ fieldName: string ]: ( Resolver<any, any, TContext, any> | SubscriptionResolver<any, any, TContext, any> ) } };

export type IDirectiveResolvers<Result> = {
skip?: SkipDirectiveResolver<Result>;
Expand Down
6 changes: 3 additions & 3 deletions packages/plugins/typescript-resolvers/src/root.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ export type IResolvers<TContext = {{{ getContext }}}> = {
{{#each scalars}}
{{ convert name 'typeNames'}}{{#unless @root.config.strict}}?{{/unless}}: GraphQLScalarType;
{{/each}}
} & { [typeName: string] : never };
} & { [typeName: string] : { [ fieldName: string ]: ( Resolver<any, any, TContext, any> | SubscriptionResolver<any, any, TContext, any> ) } };

export type IDirectiveResolvers<Result> = {
export type IDirectiveResolvers<Result, TContext = {{{ getContext }}}> = {
{{#each definedDirectives}}
{{ name }}{{#unless @root.config.strict}}?{{/unless}}: {{ convert name 'typeNames'}}DirectiveResolver<Result>;
{{/each}}
} & { [directiveName: string] : never };
} & { [directiveName: string] : DirectiveResolverFn<any, any, TContext> };
Original file line number Diff line number Diff line change
Expand Up @@ -1237,16 +1237,16 @@ describe('Resolvers', () => {
Node?: NodeResolvers;
PostOrUser?: PostOrUserResolvers;
Date?: GraphQLScalarType;
} & { [typeName: string] : never };
} & { [typeName: string] : { [ fieldName: string ]: ( Resolver<any, any, TContext, any> | SubscriptionResolver<any, any, TContext, any> ) } };
`);

expect(content).toBeSimilarStringTo(`
export type IDirectiveResolvers<Result> = {
export type IDirectiveResolvers<Result, TContext = {}> = {
modify?: ModifyDirectiveResolver<Result>;
skip?: SkipDirectiveResolver<Result>;
include?: IncludeDirectiveResolver<Result>;
deprecated?: DeprecatedDirectiveResolver<Result>;
} & { [directiveName: string] : never };
} & { [directiveName: string] : DirectiveResolverFn<any, any, TContext> };
`);
});

Expand Down

0 comments on commit ca269f7

Please sign in to comment.