A helper library for graphql-code-generator client-preset that provides the `UnmaskFragment` utility type and `makeFragmentData` function to work around the nested fragment masking issue (https://github.com/dotansimha/graphql-code-generator/issues/9702). Version 1.2.0 is current; the package is stable with no frequent releases. It is an interim solution until the upstream PR is merged. Key differentiator: resolves typing problems with nested fragments in client-preset without workarounds.
npm install graphql-code-generator-unmask-fragmentNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to use UnmaskFragment to get unmasked types and makeFragmentData to create fragment data for testing.
Migrate to the built-in unmasking feature from graphql-code-generator when available in a future version.
Ensure fragments are defined using `graphql()` from a library that returns TypedDocumentNode, e.g., `gql.tada` or `@graphql-typed-document-node/core`.
Use TypeScript to ensure type safety when constructing data.
Use `import` syntax instead of `require`. Ensure your project supports ESM.
Run `npm install graphql-code-generator-unmask-fragment` and ensure tsconfig.json includes "moduleResolution": "node" or "bundler".
Define fragments using `graphql()` from a TypedDocumentNode library (e.g., `gql.tada`).
Ensure the data object has the correct shape and all required fields as defined in the fragment.
Use `import type { UnmaskFragment } from 'graphql-code-generator-unmask-fragment'` for type-only usage.