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

[core-paging] Update the return type for "next" method in PagedAsyncIterableIterator #10599

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/core/core-paging/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 1.1.2 (Unreleased)

- Provided down-leveled type declaration files to support older TypeScript versions 3.1 to 3.6.
[PR 10599](https://github.com/Azure/azure-sdk-for-js/pull/10599)

## 1.1.1 (2020-04-02)

Expand Down
12 changes: 10 additions & 2 deletions sdk/core/core-paging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@
"clientruntime"
],
"main": "./dist-esm/index.js",
"types": "./types/corePaging.d.ts",
"types": "./types/latest/corePaging.d.ts",
"typesVersions": {
"<3.6": {
"types/latest/*": [
"types/3.1/*"
]
}
},
"files": [
"types/*.d.ts",
"types/latest/corePaging.d.ts",
"types/3.1",
"dist-esm/**/*.js",
"LICENSE",
"README.md"
Expand Down
33 changes: 33 additions & 0 deletions sdk/core/core-paging/types/3.1/corePaging.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import "@azure/core-asynciterator-polyfill";
/**
* @interface
* An interface that tracks the settings for paged iteration
*/
export interface PageSettings {
/**
* @member {string} [continuationToken] The token that keeps track of where to continue the iterator
*/
continuationToken?: string;
/**
* @member {number} [pageSize] The size of the page during paged iteration
*/
maxPageSize?: number;
}
/**
* @interface
* An interface that allows async iterable iteration both to completion and by page.
*/
export interface PagedAsyncIterableIterator<T, PageT = T[], PageSettingsT = PageSettings> {
/**
* @member {Promise} [next] The next method, part of the iteration protocol
*/
next(): Promise<IteratorResult<T>>;
Copy link
Member Author

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.

@jeremymeng @bterlson

/**
* @member {Symbol} [asyncIterator] The connection to the async iterator, part of the iteration protocol
*/
[Symbol.asyncIterator](): PagedAsyncIterableIterator<T, PageT, PageSettingsT>;
/**
* @member {Function} [byPage] Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings?: PageSettingsT) => AsyncIterableIterator<PageT>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ export interface PagedAsyncIterableIterator<T, PageT = T[], PageSettingsT = Page
/**
* @member {Promise} [next] The next method, part of the iteration protocol
*/
next(): Promise<{
done?: boolean;
value: T;
}>;
next(): Promise<IteratorResult<T, T>>;
/**
* @member {Symbol} [asyncIterator] The connection to the async iterator, part of the iteration protocol
*/
Expand Down