Conversation
The `iterator()` function returns an object containing a key of `Symbol.asyncIterator`, which is an object with a `next()` function. Only the top-level has the `Symbol.asyncIterator`, and the `next()` function is not present at the top-level
This comment was marked as off-topic.
This comment was marked as off-topic.
1 task
This comment was marked as resolved.
This comment was marked as resolved.
This helps TypeScript correctly get the keys containing the data
AsyncIterator vs AsyncIterableIterator
oscard0m
approved these changes
Sep 29, 2024
Contributor
|
🎉 This PR is included in version 11.3.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
1 task
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
iterator()function returns an object containing a key ofSymbol.asyncIterator, which is an object with anext()function. Only the top-level has theSymbol.asyncIterator, and thenext()function is not present at the top-levelThe
GetResultsType<T>sometimes doesn't return the paginated data and returns the whole data object. For some reason TypeScript sometimes get's confused and returns all the keys in the object in the callKnownKeysMatching<T["data"], any[]>In order to remedy that, we remove keys that we know do not contain the data (
"repository_selection" | "total_count" | "incomplete_results") and we then always get the data.The
NormalizeResponse<T>type would return the intersection of the original data from the request and the paginated data. To remedy that, we useOmit<T, K>to remove thedatafrom the request data and only return the paginated data instead.Resolves #350
Before the change?
GetResultsType<T>wouldn't always get the key with the dataAfter the change?
AsyncIteratorvsAsyncIterableIteratorGetResultsType<T>correctly gets the pagination dataPull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!
While not strictly a breaking change, it can cause breakage to end users as the types have changed.