Skip to content
Shared TypeScript definitions for Octokit projects
TypeScript JavaScript
Branch: master
Clone or download

Latest commit

dependabot build(deps): bump @types/node from 14.0.4 to 14.0.5
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.0.4 to 14.0.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Latest commit a038881 May 22, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github ci: replace Greenkeeper with Dependabot (#74) May 20, 2020
scripts/update-endpoints docs: description update (#80) May 20, 2020
src docs: description update (#80) May 20, 2020
.gitignore build: use pika to build before release (#63) May 12, 2020
CODE_OF_CONDUCT.md docs(CODE_OF_CONDUCT): Contributor Covenant Oct 18, 2019
CONTRIBUTING.md docs(CONTRIBUTING): remove mention of `npm run build` Oct 24, 2019
LICENSE docs(LICENSE): MIT Oct 18, 2019
README.md ci: replace Greenkeeper with Dependabot (#74) May 20, 2020
package-lock.json build(deps): bump @types/node from 14.0.4 to 14.0.5 May 22, 2020
package.json fix: `files` parameter for create/update a gist, gist response schemas ( May 17, 2020
test.ts feat: Add optional defaults type parameter to EndpointInterface & Req… Apr 19, 2020
tsconfig.json build: use pika to build before release (#63) May 12, 2020

README.md

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 "./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 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

You can’t perform that action at this time.