-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[core-paging] Update the return type for "next" method in PagedAsyncIterableIterator #10599
[core-paging] Update the return type for "next" method in PagedAsyncIterableIterator #10599
Conversation
Update PR title to reflect this is a |
More info : While For TS version < 3.6, The only solution is to have different type definitions for lower TS versions. Created an issue at sandersn/downlevel-dts#40 |
/** | ||
* @member {Promise} [next] The next method, part of the iteration protocol | ||
*/ | ||
next(): Promise<IteratorResult<T>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added separate .dts file for 3.1 to 3.5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
Issue
done
is a required property in theIteratorResult<T>
if the typescript version is 3.1(for all <3.6 probably).Whereas
done
is optional in the return type of the "next()" method in thePagedAsyncIterableIterator
.Compilation with tsc(TS3.1) fails due to this type mismatch when the target version is higher than ES5(example: ES6 or ESNEXT).
Fix
Instead of declaring our own return type for the
next()
method, useIteratorResult<T>
to avoid type mismatch.