Socket
Socket
Sign inDemoInstall

graphql-codegen-typescript-operation-types

Package Overview
Dependencies
198
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    graphql-codegen-typescript-operation-types

GraphQL codegen plugin that generates only the types used in the operations


Version published
Weekly downloads
14K
increased by24.02%
Maintainers
1
Install size
21.1 MB
Created
Weekly downloads
 

Changelog

Source

2.0.1 (2023-07-04)

Miscellaneous

  • bump release node version to 16 (#80) (17adbe2)

Readme

Source

graphql-codegen-typescript-operation-types

This graphql-codegen plugin generates the base TypeScript types used in the graphql operations.

Intended as a drop in replacement for the typescript plugin but only generates the input, enums, and object types utilized in the graphql operations. Use one of @graphql-codegen/typescript or graphql-codegen-typescript-operation-types, not both. This plugin uses the underlying typescript plugin but only outputs used types.

The types generated by this plugin are simple, and refers to the exact structure of your schema.

This plugin is best used in conjunction with the typescript-operations plugin with preResolveTypes: true and setting omitObjectTypes: true. In this configuration this plugin will emit only the enum and input types used in the graphql mutations or queries.

All scalar types are always emitted.

Example

Types only

overwrite: true
schema: 'path/to/schema.gql'

generates:
  path/to/file.ts:
    documents: 'path/to/gql/**/*.graphql'
    plugins:
      - graphql-codegen-typescript-operation-types
    config:
      omitObjectTypes: true

Types and fragments

overwrite: true
schema: 'path/to/schema.gql'

generates:
  path/to/file.ts:
    documents: 'path/to/gql/**/*.graphql'
    config:
      omitObjectTypes: true
      preResolveTypes: true
    plugins:
      - graphql-codegen-typescript-operation-types
      - typescript-operations

Keywords

FAQs

Last updated on 04 Jul 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc