1
0
Fork 0

docs: update deprecated types package

Update deprecated @octokit/webhooks-definitions to @octokit/webhooks-definitions
pull/880/head
hiroki osame 2021-08-14 01:02:25 -04:00 committed by GitHub
parent f0b00fd201
commit 069c6913e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -59,15 +59,15 @@ const newIssue = await octokit.rest.issues.create({
## Webhook payload typescript definitions ## Webhook payload typescript definitions
The npm module `@octokit/webhooks-definitions` provides type definitions for the response payloads. You can cast the payload to these types for better type information. The npm module [`@octokit/webhooks-types`](https://github.com/octokit/webhooks/tree/master/payload-types#readme) provides type definitions for the response payloads. You can cast the payload to these types for better type information.
First, install the npm module `npm install @octokit/webhooks-definitions` First, install the npm module `npm install @octokit/webhooks-types`
Then, assert the type based on the eventName Then, assert the type based on the eventName
```ts ```ts
import * as core from '@actions/core' import * as core from '@actions/core'
import * as github from '@actions/github' import * as github from '@actions/github'
import {PushEvent} from '@octokit/webhooks-definitions/schema' import type {PushEvent} from '@octokit/webhooks-types'
if (github.context.eventName === 'push') { if (github.context.eventName === 'push') {
const pushPayload = github.context.payload as PushEvent const pushPayload = github.context.payload as PushEvent