diff --git a/dev-test/test-schema/resolvers-root.ts b/dev-test/test-schema/resolvers-root.ts index 61edb77a40b..9fc5b3d082a 100644 --- a/dev-test/test-schema/resolvers-root.ts +++ b/dev-test/test-schema/resolvers-root.ts @@ -171,13 +171,11 @@ export interface DeprecatedDirectiveArgs { reason?: string; } - - export type IResolvers = { QueryRoot?: QueryRootResolvers.Resolvers; User?: UserResolvers.Resolvers; SubscriptionRoot?: SubscriptionRootResolvers.Resolvers; -} & { [typeName: string] : never }; +} & { [typeName: string] : { [ fieldName: string ]: ( Resolver | SubscriptionResolver ) } }; export type IDirectiveResolvers = { skip?: SkipDirectiveResolver; diff --git a/packages/plugins/typescript-resolvers/src/root.handlebars b/packages/plugins/typescript-resolvers/src/root.handlebars index c19703c5a78..5d208631257 100644 --- a/packages/plugins/typescript-resolvers/src/root.handlebars +++ b/packages/plugins/typescript-resolvers/src/root.handlebars @@ -79,10 +79,10 @@ export type IResolvers = { {{#each scalars}} {{ convert name 'typeNames'}}{{#unless @root.config.strict}}?{{/unless}}: GraphQLScalarType; {{/each}} -} & { [typeName: string] : never }; +} & { [typeName: string] : { [ fieldName: string ]: ( Resolver | SubscriptionResolver ) } }; -export type IDirectiveResolvers = { +export type IDirectiveResolvers = { {{#each definedDirectives}} {{ name }}{{#unless @root.config.strict}}?{{/unless}}: {{ convert name 'typeNames'}}DirectiveResolver; {{/each}} -} & { [directiveName: string] : never }; +} & { [directiveName: string] : DirectiveResolverFn }; diff --git a/packages/plugins/typescript-resolvers/tests/typescript-resolvers.spec.ts b/packages/plugins/typescript-resolvers/tests/typescript-resolvers.spec.ts index 08a5cb90e23..f3916fada6f 100644 --- a/packages/plugins/typescript-resolvers/tests/typescript-resolvers.spec.ts +++ b/packages/plugins/typescript-resolvers/tests/typescript-resolvers.spec.ts @@ -1237,16 +1237,16 @@ describe('Resolvers', () => { Node?: NodeResolvers; PostOrUser?: PostOrUserResolvers; Date?: GraphQLScalarType; - } & { [typeName: string] : never }; + } & { [typeName: string] : { [ fieldName: string ]: ( Resolver | SubscriptionResolver ) } }; `); expect(content).toBeSimilarStringTo(` - export type IDirectiveResolvers = { + export type IDirectiveResolvers = { modify?: ModifyDirectiveResolver; skip?: SkipDirectiveResolver; include?: IncludeDirectiveResolver; deprecated?: DeprecatedDirectiveResolver; - } & { [directiveName: string] : never }; + } & { [directiveName: string] : DirectiveResolverFn }; `); });