rest.js icon indicating copy to clipboard operation
rest.js copied to clipboard

TypeScript: Property 'commits' does not exist on 'payload'

Open jsjoeio opened this issue 4 years ago • 10 comments

Checklist

  • [x] I checked all open bugs and none of them matched my problem.

Environment

  • [ ] https://api.github.com
  • [ ] GitHub Enterprise Server:
  • [ ] GitHub Enterprise Cloud
  • [x] Node.js
  • [ ] Browsers:
  • [x] Others: using Octokit in a TypeScript project

Versions

^18.12.

What happened?

It appears that the package doesn't contain all the required fields on payload.

image

Repo: https://github.com/jsjoeio/github-email-extension

Minimal test case to reproduce the problem

Playground Link

What did you expect to happen?

I expected to have the types match actual data.

What the problem might be

Types are missing the correct payload structure for PushEvent

NOTES Found this issue with my friend @beraliv

jsjoeio avatar Nov 26 '21 17:11 jsjoeio

Thanks for this report :+1:

There's nothing we can do on our side. The types are auto-generated from GitHub's OpenAPI spec.

Unfortunately, the JS octokit packages don't have an active maintainer anymore, so we cannot update the types for the REST endpoints.

You can check out this discussion for further updates

wolfy1339 avatar Nov 26 '21 17:11 wolfy1339

Ah bummer! Okay well thank you for the quick update.

jsjoeio avatar Nov 26 '21 18:11 jsjoeio

Hi @jsjoeio, Is this still an issue for you with the latest updates that have been made to this project?

wolfy1339 avatar Jul 04 '22 02:07 wolfy1339

Hi @wolfy1339 - apologies, I don't really have the time these days to check. Here is where I was having issues: https://github.com/jsjoeio/github-email-extension/blob/master/src/content_script.ts#L110

Otherwise, feel to close

jsjoeio avatar Jul 11 '22 19:07 jsjoeio

This seems like an issue upstream, the OpenAPI spec isn't complete for this endpoint it seems

wolfy1339 avatar Jul 11 '22 19:07 wolfy1339

We'll need an example of a PushEvent with undocumented properties so we can investigate this on the GitHub side - I've requested that here. If anyone can help, that would be amazing.

timrogers avatar Jul 12 '22 11:07 timrogers

It's not that there's undocumented properties on the PushEvent, it's that the property commits isn't defined on the response type of the endpoint

wolfy1339 avatar Jul 12 '22 12:07 wolfy1339

I understand that 😊 It'd just be helpful to have an example JSON response that I can share to demonstrate the problem.

timrogers avatar Jul 12 '22 13:07 timrogers