octokit / core.js

Extendable client for GitHub's REST & GraphQL APIs
MIT License
1.18k stars 307 forks source link

[BUG]: The type of 'data' field in OctokitResponse type is an object but type hinting show it's an array #648

Closed Xheldon closed 8 months ago

Xheldon commented 8 months ago

What happened?

The type of 'data' field in OctokitResponse type is an object but type hinting show it's an array, as a result, I received a type error: 'sha' does not exist on the 'data' type.

see the image:

CleanShot_2024_01_08_at_18_09_33@2x

CleanShot_2024_01_08_at_18_14_48@2x

Versions

"octokit": "^3.1.2" node -v v18.16.0

Relevant log output

NO

Code of Conduct

github-actions[bot] commented 8 months ago

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

wolfy1339 commented 8 months ago

This is normal as the endpoint can return an array of objects depending on the media type.

https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api?apiVersion=2022-11-28#media-types