GraphQL Codegen Update, April 2026 - Operations and Client Preset v6

Eddy Nguyen
Eddy Nguyen

GraphQL Codegen typescript-operations and client-preset v6 was released with a hollistic review of dependencies, config options, and plugin interoperability to improve Developer Experience for our users:

  • Less generated code
  • Better type correctness and defaults
  • Fewer dependencies, and simpler setup

The main change

Previously, the low-level typescript plugin was used to generate all schema types, and the typescript-operations plugin referred to the schema types in its Input and Variables types. This approach led to a few problems:

  • All schema types were generated, even if unused
    • Impact: Unncessarily large generated files and extraneous types, which caused confusion to users.
  • Client and server plugins were indirectly tied together
    • Examples:
      • typescript plugin's default options were created to work for both client and server, but not optimised for either. This meant users must eventually tweaked the default config for their client use case.
      • Any attempt to reduce the generated schema types most likely touch the typescript plugin, which impacted the server plugin typescript-resolvers, because they both relied on the same generated type.
    • Impact: Slower feature turnaround, because contributors working on the client use case needed to tip-toe to avoid impacting the server use case.
  • Ways to setup Codegen config were numerous, with some requiring external plugins/presets with fragile integration

Now, typescript-operations and client-preset v6 were built with fundamental changes to solve the mentioned problems:

  • Generate schema types only when used
  • Decouple completely from typescript and typescript-resolvers
  • Improve Built-in support for setups commonly used by the community: one-file, multi-file, near-operation-file setups

Other changes

We also take the opportunity to make various improvements, and fix tricky bugs:

  • Set better defaults for scalar types
  • Remove rarely used option: preResolveTypes
  • Revamp shared options to better match client usage: avoidOptionals and inputMaybeValue
  • Ensure result fields are never optional, unless deferred or conditional
  • Improve typings for @skip / @include directives
  • Fix errors silently failing by default
  • Ensure consistent naming convention for enumValues imports and references
  • Change client-preset default hash algorithm to SHA256
  • Add usage warnings for internal utility types: Exact and Incremental
  • Update dependencies to latest versions (some are now ESM-only)

Explore

Dive deeper into related topics.

GraphQL

Proven Schema Designs and Best Practices - Part 2

Jeff Dolle
GraphQL

Proven Schema Designs and Best Practices - Part 1

Jeff Dolle

Get your API game right.