Apollo-Client Helpers
Generates helpers for improving the integration of TypeScript and Apollo-Client, based on your schema. This plugin generates fully-typed keyFields and Type-Policies for Apollo-Client.
- Version
- 5.0.0
- Weekly downloads
- 237k
- License
- MIT
- Updated
- Nov 11, 2026
Installation
npm i -D @graphql-codegen/typescript-apollo-client-helpers
yarn add -D @graphql-codegen/typescript-apollo-client-helpers
pnpm add -D @graphql-codegen/typescript-apollo-client-helpers
bun add -D @graphql-codegen/typescript-apollo-client-helpers
Config API Reference
useTypeImports
type: boolean
Will use import type {} rather than import {} when importing only types. This gives
compatibility with TypeScript’s “importsNotUsedAsValues”: “error” option
Default value: “false”
Usage Examples
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
// ...
generates: {
'path/to/file': {
plugins: ['apollo-angular'],
config: {
useTypeImports: true
},
},
},
};
export default config;
requireKeyFields
type: boolean
Remove optional sign from all keyFields fields.
Default value: “false”
requirePoliciesForAllTypes
type: boolean
Remove optional sign from all generated keys of the root TypePolicy. Default value: “false”
This plugin generates helpers for improving the integration of TypeScript and Apollo-Client, based on your schema.
This plugin generates fully-typed keyFields and Type-Policies for Apollo-Client.
How to use?
Start by adding this plugin to your configuration:
Then, use the generated TypeScript type as your signature for typePolicies: