import { PullRequestOpenedEvent } from '@octokit/webhooks-types';
import * as github from '@actions/github';
github.context.payload = {} as PullRequestOpenedEvent;
/* TS2322: Type 'PullRequestOpenedEvent' is not assignable to type 'WebhookPayload'.
Types of property 'pull_request' are incompatible.
Type 'PullRequest & { state: "open"; closed_at: null; merged_at: null; active_lock_reason: null; merged_by: null; }' is not assignable to type '{ [key: string]: any; number: number; html_url?: string | undefined; body?: string | undefined; } | undefined'.
Type 'PullRequest & { state: "open"; closed_at: null; merged_at: null; active_lock_reason: null; merged_by: null; }' is not assignable to type '{ [key: string]: any; number: number; html_url?: string | undefined; body?: string | undefined; }'.
Types of property 'body' are incompatible.
Type 'string | null' is not assignable to type 'string | undefined'.
Type 'null' is not assignable to type 'string | undefined'.*/
Expected behavior
Typing should be compatible with @octokit/webhooks-definitions
Describe the bug The body property of the WebhookPayload interface should be
string | null
, not an optional string. https://github.com/actions/toolkit/blob/bb6c50093929116e7050c394da9b9a1eb720d746/packages/github/src/interfaces.ts#L22To Reproduce
Expected behavior Typing should be compatible with
@octokit/webhooks-definitions