Skip to content

Commit f245770

Browse files
committed
fix: update README for transition types
1 parent 4b7e91d commit f245770

File tree

1 file changed

+28
-6
lines changed
  • packages/openapi-webhooks-types-transition

1 file changed

+28
-6
lines changed
Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,39 @@
1-
# @octokit/openapi-webhooks-types-transition
1+
# Octokit Webhooks
22

33
> Generated TypeScript definitions based on GitHub's OpenAPI spec
44
55
This package is continously updated based on [GitHub's OpenAPI specification](https://github.com/github/rest-api-description/)
66

77
## Usage
88

9-
```ts
10-
import { components } from "@octokit/openapi-webhooks-types-transition";
9+
```typescript
10+
import { WebhookEvent, IssuesOpenedEvent } from "@octokit/openapi-webhooks-types-transition";
1111

12-
type Repository = components["schemas"]["full-repository"];
12+
const handleWebhookEvent = (event: WebhookEvent) => {
13+
if ("action" in event && event.action === "completed") {
14+
console.log(`${event.sender.login} completed something!`);
15+
}
16+
};
17+
18+
const handleIssuesOpenedEvent = (event: IssuesOpenedEvent) => {
19+
console.log(
20+
`${event.sender.login} opened "${event.issue.title}" on ${event.repository.full_name}`,
21+
);
22+
};
1323
```
1424

15-
## License
25+
>[!IMPORTANT]
26+
> Webhooks Types are expected to be used with the [`strictNullChecks` option](https://www.typescriptlang.org/tsconfig#strictNullChecks) 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](https://github.com/octokit/webhooks/issues/395) for details.
27+
28+
## See also
29+
30+
- [octokit/graphql-schema](https://github.com/octokit/graphql-schema) – GitHub’s
31+
GraphQL Schema with validation
32+
- [octokit/openapi](https://github.com/octokit/openapi) – GitHub REST API route
33+
specifications
34+
- [octokit/app-permissions](https://github.com/octokit/app-permissions) – GitHub
35+
App permission specifications
36+
37+
## LICENSE
1638

17-
[MIT](LICENSE)
39+
[MIT](LICENSE.md)

0 commit comments

Comments
 (0)