diff --git a/sdk/core/core-paging/CHANGELOG.md b/sdk/core/core-paging/CHANGELOG.md index 465e86a8447d..6201582ad6e7 100644 --- a/sdk/core/core-paging/CHANGELOG.md +++ b/sdk/core/core-paging/CHANGELOG.md @@ -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) diff --git a/sdk/core/core-paging/package.json b/sdk/core/core-paging/package.json index bca06b4228cc..df0313d8f4d7 100644 --- a/sdk/core/core-paging/package.json +++ b/sdk/core/core-paging/package.json @@ -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" diff --git a/sdk/core/core-paging/types/3.1/corePaging.d.ts b/sdk/core/core-paging/types/3.1/corePaging.d.ts new file mode 100644 index 000000000000..bede1b5a7764 --- /dev/null +++ b/sdk/core/core-paging/types/3.1/corePaging.d.ts @@ -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 { + /** + * @member {Promise} [next] The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * @member {Symbol} [asyncIterator] The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * @member {Function} [byPage] Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: PageSettingsT) => AsyncIterableIterator; +} diff --git a/sdk/core/core-paging/types/corePaging.d.ts b/sdk/core/core-paging/types/latest/corePaging.d.ts similarity index 94% rename from sdk/core/core-paging/types/corePaging.d.ts rename to sdk/core/core-paging/types/latest/corePaging.d.ts index f9f7671e495e..ee04a39bfe13 100644 --- a/sdk/core/core-paging/types/corePaging.d.ts +++ b/sdk/core/core-paging/types/latest/corePaging.d.ts @@ -21,10 +21,7 @@ export interface PagedAsyncIterableIterator; + next(): Promise>; /** * @member {Symbol} [asyncIterator] The connection to the async iterator, part of the iteration protocol */