openapi-types.ts

Generated TypeScript definitions built continuously from GitHub's official OpenAPI specification.

Library
npm
v28.0.0
56stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
62/100Good
Development Activity64
Maintenance68
Community44
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture78
Code Quality80
Innovation72
Learning Curve85

openapi-types.ts continuously converts GitHub’s official OpenAPI specification into TypeScript definitions and publishes them to npm as @octokit/openapi-types. It provides precise, always-current types for every GitHub REST API endpoint, request, and response, so consumers never hand-maintain GitHub API shapes.

The package is the type foundation of the Octokit ecosystem and is consumed by clients like @octokit/types, but it is also useful on its own for anyone building tools against the GitHub API in TypeScript. Because the types are regenerated from the upstream spec, they stay in lockstep with GitHub’s evolving API surface.

What You Get

  • Complete TypeScript types for GitHub REST API endpoints, requests, and responses
  • Types generated directly from GitHub’s official OpenAPI description, kept continuously in sync
  • Zero runtime dependencies — pure ambient type declarations
  • The type foundation used across the Octokit client libraries
  • GitHub Enterprise Server variants published as companion packages

Common Use Cases

  • Adding precise GitHub API types to Octokit-based clients and plugins
  • Type-checking custom tooling that calls the GitHub REST API
  • Deriving request/response types for specific GitHub endpoints
  • Keeping GitHub API integrations in sync with the latest spec

Under The Hood

Architecture — The repo is a monorepo whose scripts/ pipeline downloads GitHub’s OpenAPI description (download.js), converts it to TypeScript with openapi-typescript (generate-types.js), and stamps versions before publishing (update-package.js). The primary package packages/openapi-types ships a single large types.d.ts (multiple megabytes) exposing the full API surface as ambient declarations; parallel packages target GitHub Enterprise Server releases.

Tech Stack — Pure TypeScript output with zero runtime dependencies in the published package. The generation toolchain is Node.js scripts driving openapi-typescript, run on a schedule to track upstream spec changes.

Code Quality — Because the types are machine-generated from an authoritative source, correctness follows from the upstream OpenAPI spec rather than hand-written code; the value is completeness and freshness. Repo structure cleanly separates generation scripts, per-version packages, and a cache of downloaded specs.

API Design — Consumers simply import the type namespaces; there is no runtime API to learn. The design deliberately keeps the package a passive type dependency, letting higher-level Octokit libraries expose ergonomic wrappers on top.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search