npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kuindji/typed-graphql

v1.0.3

Published

Compile-time GraphQL validation and type inference for TypeScript

Readme

@kuindji/typed-graphql

Compile-time GraphQL validation, variables inference, and result-type inference for TypeScript.

You write a GraphQL query as a normal TypeScript string. The library checks it against a schema type while tsc runs and infers both:

  • the returned data shape; and
  • the runtime variables object.

The core is intentionally AST-less. It uses a strict shallow compiler that walks the source string directly, validates only the selected operation plus referenced fragments, and returns structured GraphQLError diagnostics for invalid input. Nothing runs at runtime for validation or inference.

This is a sibling of @kuindji/typed-sql, using the same bias toward type-level performance: direct source walks, bounded chunking, no token-array materialization, and no public AST layer.

Public API

import type {
    GetReturnType,
    GetSelectionType,
    GetVariables,
    GraphQLInput,
    GraphQLSchema,
    IsValidGraphQL,
    ValidateGraphQL,
    ValidateSelection,
} from "@kuindji/typed-graphql";

type UserId = string & { readonly __table: "User" };

type Schema = {
    defaultSchema: "public";
    schemas: {
        public: {
            Query: {
                version: string;
            };
            User: {
                id: UserId;
                email: string | null;
            };
        };
    };
    relations: {
        public: {
            Query: {
                user: { type: "User"; nullable: true };
            };
        };
    };
    arguments: {
        public: {
            Query: {
                user: {
                    id: GraphQLInput<"ID!", UserId>;
                };
            };
        };
    };
};

type Query = `query User($id: ID!) {
    user(id: $id) {
        id
        email
    }
}`;

type Valid = ValidateGraphQL<Query, Schema>; // true
type IsValid = IsValidGraphQL<Query, Schema>; // true
type Data = GetReturnType<Query, Schema>; // { user: { id: UserId; email: string | null } | null }
type Variables = GetVariables<Query, Schema>; // { id: UserId }

type Partial = GetSelectionType<"id email", Schema, "User">;
type PartialValid = ValidateSelection<"id email", Schema, "User">;

Runtime construction

The core stays type-only. Runtime query building ships as separate entries:

  • @kuindji/typed-graphql/runtime — the transport-neutral boundary: GraphQLRequest, GraphQLExecutor, extractResult, and document assembly helpers. You inject an executor that owns transport, authentication, retry, and error reporting. unwrapResponse turns a standard { data, errors } envelope into root data, throwing GraphQLResponseError when the response carries errors (extractErrors reads the list without throwing):

    const executor = {
        execute: async (request) => unwrapResponse(await post(request)),
    };
  • @kuindji/typed-graphql/hasura — an immutable, chainable Hasura builder typed by the same schema:

import { createHasuraClient } from "@kuindji/typed-graphql/hasura";

const client = createHasuraClient<Schema>()({
    executor: { execute: async (request) => runRequestSomehow(request) },
    primaryKeys: { User: "id" },
    defaultSelections: { User: "id email" },
});

const users = await client.table("User").eq("email", "[email protected]").limit(10);
const one = await client.table("User").id(userId).one();
const count = await client.table("User").count();

Development

See CONTRIBUTING.md.

The roadmap and design constraints are in GOALS.md.

License

MIT © Ivan Kuindzhi