diff --git a/.changeset/fruity-comics-argue.md b/.changeset/fruity-comics-argue.md new file mode 100644 index 00000000000..34db46dda09 --- /dev/null +++ b/.changeset/fruity-comics-argue.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/client-preset': minor +--- + +The client preset now allows the use of the `futureProofUnions` config option diff --git a/packages/presets/client/src/index.ts b/packages/presets/client/src/index.ts index a5c72a9d9a8..f8c30d8b37a 100644 --- a/packages/presets/client/src/index.ts +++ b/packages/presets/client/src/index.ts @@ -134,6 +134,7 @@ export const preset: Types.OutputPreset = { enumsAsConst: options.config.enumsAsConst, enumValues: options.config.enumValues, futureProofEnums: options.config.futureProofEnums, + futureProofUnions: options.config.futureProofUnions, nonOptionalTypename: options.config.nonOptionalTypename, avoidOptionals: options.config.avoidOptionals, documentMode: options.config.documentMode, diff --git a/website/src/pages/plugins/presets/preset-client.mdx b/website/src/pages/plugins/presets/preset-client.mdx index 50984f7b626..ad719eb267e 100644 --- a/website/src/pages/plugins/presets/preset-client.mdx +++ b/website/src/pages/plugins/presets/preset-client.mdx @@ -56,6 +56,7 @@ The `client` preset allows the following `config` options: - [`enumsAsConst`](/plugins/typescript/typescript#enumsasconst): Generates enum as TypeScript const assertions instead of enum. This can even be used to enable enum-like patterns in plain JavaScript code if you choose not to use TypeScript’s enum construct. - [`enumValues`](/plugins/typescript/typescript#enumvalues): Overrides the default value of enum values declared in your GraphQL schema. You can also map the entire enum to an external type by providing a string that of module#type. - [`futureProofEnums`](/plugins/typescript/typescript#futureproofenums): Adds a catch-all entry to enum type definitions for values that may be added in the future. +- [`futureProofUnions`](/plugins/typescript/typescript#futureproofunions): Adds a catch-all entry to union type definitions for values that may be added in the future. - [`nonOptionalTypename`](/plugins/typescript/typescript#nonoptionaltypename): Automatically adds `__typename` field to the generated types, even when they are not specified in the selection set, and makes it non-optional. - [`avoidOptionals`](/plugins/typescript/typescript#avoidoptionals): This will cause the generator to avoid using TypeScript optionals (`?`) on types. - [`documentMode`](#documentmode): Allows you to control how the documents are generated.