| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| @apollo_client-graphql-codegen@2.2.0 source code.tar.gz | 2026-09-11 | 4.1 MB | |
| @apollo_client-graphql-codegen@2.2.0 source code.zip | 2026-09-11 | 4.7 MB | |
| README.md | 2026-09-11 | 4.0 kB | |
| Totals: 3 Items | 8.8 MB | 0 | |
Add support for generating configuration objects for custom scalars in Apollo Client.
:::ts
// codegen.ts
import type { CustomScalarsPluginConfig } from "@apollo/client-graphql-codegen/custom-scalars";
const config: CodegenConfig = {
// ...
generates: {
"./path/to/custom-scalars.ts": {
plugins: ["@apollo/client-graphql-codegen/custom-scalars"],
config: {
// ...
} satisfies CustomScalarsPluginConfig,
},
},
};
This will generate both an inputObjects object and a scalarTypePolicies object in the generated file that can be used to configure custom scalars in InMemoryCache.
:::ts
import { inputObjects, scalarTypePolicies } from "./path/to/custom-scalars";
const cache = new InMemoryCache({
inputObjects,
});
cache.policies.addTypePolicies(scalarTypePolicies);
For more information on using custom scalars, read the Custom Scalars guide.