Wondering what’s next for npm?Check out our public roadmap! »

    @octokit/types
    TypeScript icon, indicating that this package has built-in type declarations

    6.13.1 • Public • Published

    types.ts

    Shared TypeScript definitions for Octokit projects

    @latest Build Status

    Usage

    See all exported types at https://octokit.github.io/types.ts

    Examples

    Get parameter and response data types for a REST API endpoint

    import { Endpoints } from "@octokit/types";
    
    type listUserReposParameters = Endpoints["GET /repos/{owner}/{repo}"]["parameters"];
    type listUserReposResponse = Endpoints["GET /repos/{owner}/{repo}"]["response"];
    
    async function listRepos(
      options: listUserReposParameters
    ): listUserReposResponse["data"] {
      // ...
    }

    Get response types from endpoint methods

    import {
      GetResponseTypeFromEndpointMethod,
      GetResponseDataTypeFromEndpointMethod,
    } from "@octokit/types";
    import { Octokit } from "@octokit/rest";
    
    const octokit = new Octokit();
    type CreateLabelResponseType = GetResponseTypeFromEndpointMethod<
      typeof octokit.issues.createLabel
    >;
    type CreateLabelResponseDataType = GetResponseDataTypeFromEndpointMethod<
      typeof octokit.issues.createLabel
    >;

    Contributing

    See CONTRIBUTING.md

    License

    MIT

    Install

    npm i @octokit/types

    DownloadsWeekly Downloads

    5,416,466

    Version

    6.13.1

    License

    MIT

    Unpacked Size

    201 kB

    Total Files

    51

    Last publish

    Collaborators

    • avatar
    • avatar