JSPM

  • Created
  • Published
  • Downloads 16606106
  • Score
    100M100P100Q233960F
  • License MIT

Shared TypeScript definitions for Octokit projects

Package Exports

  • @octokit/types

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@octokit/types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

types.ts

Shared TypeScript definitions for Octokit projects

@latest Build Status Greenkeeper

Usage

Get parameter and response data types for a REST API endpoint

import { Endpoints } from "./src";

type listUserReposParameters = Endpoints["GET /repos/:owner/:repo"]["parameters"];
type listUserReposResponse = Endpoints["GET /repos/:owner/:repo"]["response"];

async function listRepos(
  options: listUserReposParameters
): listUserReposResponse["data"] {
  // ...
}

Get parameter types for a REST API endpoint

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
>;

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

Contributing

See CONTRIBUTING.md

License

MIT