Registry / devops / graphql-codegen-typescript-operation-types

graphql-codegen-typescript-operation-types

JSON →
library2.0.2jsnpmunverified

This is a @graphql-codegen plugin (v2.0.2, active development) that generates only the TypeScript types (inputs, enums, objects) actually used in your GraphQL operations. It acts as a drop-in replacement for the official @graphql-codegen/typescript plugin but reduces output size by excluding unused types. It is designed to work alongside @graphql-codegen/typescript-operations with preResolveTypes: true. Requires Node >=16 and graphql@0.12-16. Ship TypeScript definitions.

npm install graphql-codegen-typescript-operation-types
INSTALL
IMPORT
SIG · GRAPHQL-CODEGEN-TY
G
graphql-codegen-typescript-operation-types
devopsjavascriptv2.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

typescript plugin
// In graphql-codegen config YAML: plugins: - graphql-codegen-typescript-operation-types
plugins: - @graphql-codegen/typescript
Do not use both; this plugin replaces @graphql-codegen/typescript.

Generates minimal TypeScript types for used GraphQL operations, combining operation types plugin.

// codegen.yml overwrite: true schema: 'schema.graphql' documents: 'operations/**/*.graphql' generates: generated-types.ts: plugins: - graphql-codegen-typescript-operation-types - typescript-operations config: omitObjectTypes: true preResolveTypes: true // Then run: graphql-codegen
Debug
Known issues
breakingplugin replaces @graphql-codegen/typescript; using both will cause conflicts
fix
Remove @graphql-codegen/typescript from plugins list.
affects: >=1.0.0
gotchaomitObjectTypes: true required for minimal output; otherwise generates all object types
fix
Set config.omitObjectTypes: true if you only want enums and inputs.
affects: >=1.0.0
deprecatedold plugin name 'graphql-codegen-typescript-operation-types' is correct; do not use scoped @graphql-codegen/ prefix
fix
Use unscoped name in plugins list.
affects: <2.0
Errors
Common errors & fixes
Cannot use GraphQLSchema "[object Object]" from another module or realm.
Multiple instances of graphql package installed
fix
Ensure only one version of graphql is installed (npm dedupe).
TypeError: Cannot read properties of undefined (reading 'getType')
Missing or invalid schema file path in codegen.yml
fix
Check schema path and ensure schema is valid.
Plugin graphql-codegen-typescript-operation-types not found
Plugin not installed or not added to devDependencies
fix
npm install --save-dev graphql-codegen-typescript-operation-types
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
graphql-codegen-typescript-operation-types — npm install graphql-codegen-typescript-operation-types · libregistry