@octokit/openapi-webhooks-types-transition
v12.1.0
Published
Transition package for OpenAPI Webhooks Types
Readme
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}`,
);
};[!IMPORTANT] Webhooks Types are expected to be used with the
strictNullChecksoption enabled in yourtsconfig. If you don't have this option enabled, there's the possibility that you getneveras the inferred type in some use cases. See octokit/webhooks#395 for details.
See also
- octokit/graphql-schema – GitHub’s GraphQL Schema with validation
- octokit/openapi – GitHub REST API route specifications
- octokit/app-permissions – GitHub App permission specifications
