Which packages are impacted by your issue?
@graphql-codegen/typescript-resolvers
Describe the bug
If you have a type named Subscription:
type Query {
subscriptions: [Subscription]
}
type Subscription {
name: String
}
The generated output becomes:
export type QueryResolvers<ContextType = any, ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query']> = {
subscriptions?: Resolver<Maybe<Array<Maybe<ResolversTypes['Subscription']>>>, ParentType, ContextType>;
};
export type SubscriptionResolvers<ContextType = any, ParentType extends ResolversParentTypes['Subscription'] = ResolversParentTypes['Subscription']> = {
name?: SubscriptionResolver<Maybe<ResolversTypes['String']>, "name", ParentType, ContextType>; // wrong
};
export type Resolvers<ContextType = any> = {
Query?: QueryResolvers<ContextType>;
Subscription?: SubscriptionResolvers<ContextType>;
};
This is wrong. The name field should be a Resolver instead of SubscriptionResolver.
Your Example Website or App
https://codesandbox.io/p/sandbox/youthful-fermat-cg7ppp?file=%2Ftypes.ts&selection=%5B%7B%22endColumn%22%3A30%2C%22endLineNumber%22%3A133%2C%22startColumn%22%3A10%2C%22startLineNumber%22%3A133%7D%5D
Steps to Reproduce the Bug or Issue
- Open the sandbox.
- Run
yarn generate
- Go to the
types.ts file and see the wrong type.
Expected behavior
The name field should be a Resolver instead of SubscriptionResolver.
Screenshots or Videos
No response
Platform
"@graphql-codegen/cli": "^2.16.4",
"@graphql-codegen/typescript": "^2.8.7",
"@graphql-codegen/typescript-resolvers": "^2.7.12",
Codegen Config File
schema: "./schema.graphql"
generates:
types.ts:
plugins:
- "typescript"
- "typescript-resolvers"
Additional context
No response
Which packages are impacted by your issue?
@graphql-codegen/typescript-resolvers
Describe the bug
If you have a type named
Subscription:The generated output becomes:
This is wrong. The
namefield should be aResolverinstead ofSubscriptionResolver.Your Example Website or App
https://codesandbox.io/p/sandbox/youthful-fermat-cg7ppp?file=%2Ftypes.ts&selection=%5B%7B%22endColumn%22%3A30%2C%22endLineNumber%22%3A133%2C%22startColumn%22%3A10%2C%22startLineNumber%22%3A133%7D%5D
Steps to Reproduce the Bug or Issue
yarn generatetypes.tsfile and see the wrong type.Expected behavior
The
namefield should be aResolverinstead ofSubscriptionResolver.Screenshots or Videos
No response
Platform
Codegen Config File
Additional context
No response