A code generation tool that produces a strongly typed GraphQL client library for any endpoint. Version 1.7.4 is the latest stable release. It enables writing GraphQL queries as plain JavaScript objects with full TypeScript type safety, auto-completion, custom scalar mapping, and type guards. The client supports chain request syntax and raw request syntax, generating standard GraphQL queries from idiomatic JS. Unlike generic GraphQL clients (e.g., graphql-request), this package generates a tailored client per schema, offering superior developer experience for TypeScript projects. Maintenance appears low, with the last release in 2020.
npm install graphql-typed-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Use TypeScript's moduleResolution: 'node' or add a bundler that handles ESM.
Use the function export directly in a script instead of the CLI command.
Ensure your fetcher returns a Promise and logs errors on failure.
Define scalarTypeMap in the config to map scalars to actual types.
Install 'qs' as a dependency or provide a custom fetcher that handles query string manually.
Use forward slashes or an array of file paths via a config file.
Run 'npm install -g graphql-typed-client' for CLI, or 'npm install graphql-typed-client' in your project.
Use 'const { generateClient } = require('graphql-typed-client')' for CommonJS, or import { generateClient } from 'graphql-typed-client' for ESM.Check the endpoint URL and authentication; use a custom fetcher with proper headers.
Install 'qs' or use a custom fetcher that doesn't rely on it.
Ensure the config exports an array of client objects or a single valid object.