@octokit/types

13.7.0last stable release 2 weeks ago
Complexity Score
Medium
Open Issues
17
Dependent Projects
173
Weekly Downloadsglobal
17,001,975

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Readme

types.ts

Shared TypeScript definitions for Octokit projects

  • Usage
  • Examples
    • Get parameter and response data types for a REST API endpoint
    • Get response types from endpoint methods
  • Contributing
  • License

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

Dependencies

No runtime dependency information found for this package.

CVE IssuesActive
0
Scorecards Score
7.10
Test Coverage
No Data
Follows Semver
Yes
Github Stars
137
Dependenciestotal
11
DependenciesOutdated
2
DependenciesDeprecated
0
Threat Modelling
No
Repo Audits
No

Learn how to distribute @octokit/types in your own private NPM registry

npm config set registry  https://npm.cloudsmith.com/owner/repo
Processing...
Done
npm install @octokit/types
Processing...
Done

214 Releases

NPM on Cloudsmith

Getting started with NPM on Cloudsmith is fast and easy.