TypeScript Generic SDK

Package nameWeekly DownloadsVersionLicenseUpdated
@graphql-codegen/typescript-generic-sdkDownloadsVersionLicenseApr 19th, 2026

Installation

npm i -D @graphql-codegen/typescript-generic-sdk
⚠️

Usage Requirements In order to use this GraphQL Codegen plugin, please make sure that you have GraphQL operations (query / mutation / subscription and fragment) set as documents: … in your codegen.yml.

Without loading your GraphQL operations (query, mutation, subscription and fragment), you won’t see any change in the generated output.

This plugin generate a generic SDK (without any Requester implemented), allow you to easily customize the way you fetch your data, without loosing the strongly-typed integration.

Config API Reference

usingObservableFrom

type: string

usingObservableFrom: import Observable from 'zen-observable' OR usingObservableFrom: import { Observable } from 'rxjs'

rawRequest

type: boolean default: false

By default the request method return the data or errors key from the response. If you need to access the extensions key you can use the rawRequest method.

Usage Examples

codegen.ts
 import type { CodegenConfig } from '@graphql-codegen/cli';
 
 const config: CodegenConfig = {
   // ...
   generates: {
     'path/to/file.ts': {
       plugins: ['typescript', 'typescript-operations', 'typescript-generic-sdk'],
       config: {
         rawRequest: true
       },
     },
   },
 };
 export default config;
💡

Make sure you have typescript plugin and typescript-operations as well in your configuration:

Usage

You can find a usage example for Apollo-Client here.