Skip to content
TypeWire

@tahanabavi/typefetch-graphql

documents v0.0.0

GraphQL transport for TypeFetch contracts — one client, one middleware chain, and selection sets generated from your Zod response schema.

Setup

ts
import { ApiClient } from "@tahanabavi/typefetch";
import { graphqlTransport } from "@tahanabavi/typefetch-graphql";
import { contracts } from "./contracts";

const client = new ApiClient(
{
baseUrl: "https://api.example.com",
transports: [
graphqlTransport({ url: "https://api.example.com/graphql" }),
],
},
contracts,
);

client.init();

Installing the package is what makes transport: "graphql" compile — it augments typefetch's TransportRegistry. Registering it explicitly is what keeps a REST-only bundle from paying for it.