npm.io
12.1.0 • Published 7 months ago

@octokit/openapi-webhooks-types-transition

Licence
MIT
Version
12.1.0
Deps
1
Size
59 kB
Vulns
0
Weekly
0
Stars
5

Octokit Webhooks

Generated TypeScript definitions based on GitHub's OpenAPI spec

This package is continously updated based on GitHub's OpenAPI specification

Usage

import {
  WebhookEvent,
  IssuesOpenedEvent,
} from "@octokit/openapi-webhooks-types-transition";

const handleWebhookEvent = (event: WebhookEvent) => {
  if ("action" in event && event.action === "completed") {
    console.log(`${event.sender.login} completed something!`);
  }
};

const handleIssuesOpenedEvent = (event: IssuesOpenedEvent) => {
  console.log(
    `${event.sender.login} opened "${event.issue.title}" on ${event.repository.full_name}`,
  );
};

Webhooks Types are expected to be used with the strictNullChecks option enabled in your tsconfig. If you don't have this option enabled, there's the possibility that you get never as the inferred type in some use cases. See octokit/webhooks#395 for details.

See also

LICENSE

MIT