Skip to content

Conversation

eddeee888
Copy link
Collaborator

@eddeee888 eddeee888 commented Sep 24, 2025

Description

We removed onlyResolveTypeForInterfaces option here and made Interface not have resolvers for shared fields. This is because this is the default GraphQL resolver behaviour.

However, some tools like @graphql-tools/schema's makeExecutableSchema may change this default behaviour with inheritResolversFromInterfaces: true option so users only have to declare the shared field resolvers once in Interfaces, and implementing types can inherit said resolvers (if none available at the implementing types level).

This PR adds addInterfaceFieldResolverTypes as a replacement for onlyResolveTypeForInterfaces so users must consciously turn this option on when using with tools that customise the behaviours.

Relevant questions: #10218 (comment), #10438 (comment)

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit test

Copy link

changeset-bot bot commented Sep 24, 2025

🦋 Changeset detected

Latest commit: b40a8cb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@graphql-codegen/visitor-plugin-common Minor
@graphql-codegen/typescript-resolvers Minor
@graphql-codegen/typescript-document-nodes Patch
@graphql-codegen/gql-tag-operations Patch
@graphql-codegen/typescript-operations Patch
@graphql-codegen/typed-document-node Patch
@graphql-codegen/typescript Patch
@graphql-codegen/graphql-modules-preset Patch
@graphql-codegen/client-preset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Sep 24, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/visitor-plugin-common 6.1.0-alpha-20251001144629-b40a8cbfdf8586bb3e4a3d39cbd6c6b0d4f1bb74 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-document-nodes 5.0.2-alpha-20251001144629-b40a8cbfdf8586bb3e4a3d39cbd6c6b0d4f1bb74 npm ↗︎ unpkg ↗︎
@graphql-codegen/gql-tag-operations 5.0.2-alpha-20251001144629-b40a8cbfdf8586bb3e4a3d39cbd6c6b0d4f1bb74 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-operations 5.0.2-alpha-20251001144629-b40a8cbfdf8586bb3e4a3d39cbd6c6b0d4f1bb74 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-resolvers 5.1.0-alpha-20251001144629-b40a8cbfdf8586bb3e4a3d39cbd6c6b0d4f1bb74 npm ↗︎ unpkg ↗︎
@graphql-codegen/typed-document-node 6.0.2-alpha-20251001144629-b40a8cbfdf8586bb3e4a3d39cbd6c6b0d4f1bb74 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript 5.0.2-alpha-20251001144629-b40a8cbfdf8586bb3e4a3d39cbd6c6b0d4f1bb74 npm ↗︎ unpkg ↗︎
@graphql-codegen/client-preset 5.0.3-alpha-20251001144629-b40a8cbfdf8586bb3e4a3d39cbd6c6b0d4f1bb74 npm ↗︎ unpkg ↗︎
@graphql-codegen/graphql-modules-preset 5.0.3-alpha-20251001144629-b40a8cbfdf8586bb3e4a3d39cbd6c6b0d4f1bb74 npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Sep 24, 2025

💻 Website Preview

The latest changes are available as preview in: https://pr-10449.graphql-code-generator.pages.dev

@eddeee888 eddeee888 changed the title [typescript-resolvers] Add interfaceFieldResolverTypes option [typescript-resolvers] Add addInterfaceFieldResolverTypes option Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant