A graphql-codegen plugin that generates TypeScript type definitions for .gql files using TypedDocumentNode, providing type-safe GraphQL documents. Current version 0.2.1, updated frequently. The plugin extends the standard typescript-graphql-files-modules by leveraging @graphql-typed-document-node/core to infer variables and data types for hooks like useQuery/useMutation, enhancing IDE support in VSCode. It requires graphql >=14.6.0 and @graphql-typed-document-node/core.
npm install typescript-graphql-typed-files-modulesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows minimal codegen configuration using the plugin with near-operation-file preset for type-safe .gql imports.
Add '*.gql.d.ts' to include or use include pattern that picks up .d.ts files.
Install @graphql-typed-document-node/core@^3
Reorder plugins in codegen.yml: - add - typescript-operations - typescript-graphql-typed-files-modules
Use this plugin instead of apollo-typed-documents for latest features.
Run graphql-codegen first. Ensure tsconfig includes 'src/**/*.gql.d.ts' or uses allowArbitraryExtensions.
Use 'import authors from "./authors.gql"' (default import).
Use preset: 'near-operation-file'
Install both graphql and @graphql-typed-document-node/core