Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IResolvers index signature #1389

Merged
merged 5 commits into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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