-
Notifications
You must be signed in to change notification settings - Fork 25
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
[BUG]: Regression with 11.4.2 adding & OctokitResponse<...> to return type #661
Comments
👋 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 labeled with |
The issue was that I was trying to fix #652, which itself was a regression from #637. At the root, I tried to fix the issue of Typescript not correctly finding the data and returning bad types. What I'm trying to do is follow the JavaScript code, return the pagination data without the pagination and add the keys to the data. |
Also, another fyi, it's bad practice to depend on For this package you can use the following: import type { PaginatingEndpoints } from "@octokit/plugin-paginate-rest";
type Package = PaginatingEndpoints["GET /orgs/{org}/packages/{package_type}/{package_name}/versions"]["response"]["data"][0]; |
I've found the root of the issue, plugin-paginate-rest.js/src/types.ts Lines 58 to 68 in 4869cba
We are returning the full OctokitResponse in there, when we should instead probably be returning an empty object |
Instead of returning `T` in `GetPaginationKeys<T>`, we return an empty object, because T would be an `OctokitResponse<T, S>`, and there is no response data in the `data` field Fixes #661
What happened?
From
11.4.1
to11.4.2
we're seeing an innocuous regression from PR #653We have a couple instances like this that are showing a return type with a union of
& OctokitResponse<...>
to the expected data response type. Assuming from here.Example code that's pulling org packages from
GET /orgs/{org}/packages/{package_type}/{package_name}/versions
Before 11.4.2 this wasn't included:
And looking at the actual data returned, I don't see any additional fields that aren't in the opanapi type.
Versions
Node v20.15.0
octokit 4.1.1
@octokit/plugin-paginate-rest 11.4.2
@octokit/types 13.7.0
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: