Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property body of WebhookPayload should be string | null not optional #1785

Open
DamianKleisinger opened this issue Aug 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@DamianKleisinger
Copy link

Describe the bug
The body property of the WebhookPayload interface should be string | null, not an optional string.

To Reproduce

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

@DamianKleisinger DamianKleisinger added the bug Something isn't working label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant