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

Use standard Typescript AsyncIterator types #1745

Merged
merged 3 commits into from
Apr 5, 2023

Conversation

richardm-stripe
Copy link
Contributor

@richardm-stripe richardm-stripe commented Apr 5, 2023

This is a follow-up to #1739 (comment).

I was originally going to make the iterator return {done: true} instead of {done: true, value: undefined} (which would have been a breaking change), but it turns out that value: undefined is actually the standard:

> [][Symbol.iterator]().next()
{ value: undefined, done: true }

And it turns out that we can use the standard Typescript types for iterators/async iterators instead of defining our own. https://github.com/microsoft/TypeScript/blob/main/src/lib/es2015.iterable.d.ts#L11-L28
Doing this is nonbreaking.

@richardm-stripe richardm-stripe changed the title Pagination iterator returns {done: true} instead of {done: true, value: undefined} Use standard Typescript AsyncIterator types Apr 5, 2023
@richardm-stripe richardm-stripe requested review from a team and anniel-stripe and removed request for a team April 5, 2023 21:36
@richardm-stripe richardm-stripe changed the base branch from sdk-release/next-major to master April 5, 2023 21:38
@richardm-stripe richardm-stripe force-pushed the richardm-autopagination-cleanup branch from f28abe8 to 1754c26 Compare April 5, 2023 21:39
@richardm-stripe richardm-stripe merged commit 9c237a3 into master Apr 5, 2023
@richardm-stripe richardm-stripe deleted the richardm-autopagination-cleanup branch April 5, 2023 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants