diff --git a/generators/typescript/utils/core-utilities/src/core/pagination/Page.ts b/generators/typescript/utils/core-utilities/src/core/pagination/Page.ts index 15f64bef32c5..b7e94c2788d1 100644 --- a/generators/typescript/utils/core-utilities/src/core/pagination/Page.ts +++ b/generators/typescript/utils/core-utilities/src/core/pagination/Page.ts @@ -4,15 +4,16 @@ import { HttpResponsePromise, type RawResponse } from "../fetcher/index"; * A page of results from a paginated API. * * @template T The type of the items in the page. + * @template R The type of the response object. */ -export class Page implements AsyncIterable { +export class Page implements AsyncIterable { public data: T[]; public rawResponse: RawResponse; + public response: R; - private response: unknown; - private _hasNextPage: (response: unknown) => boolean; - private getItems: (response: unknown) => T[]; - private loadNextPage: (response: unknown) => HttpResponsePromise; + private _hasNextPage: (response: R) => boolean; + private getItems: (response: R) => T[]; + private loadNextPage: (response: R) => HttpResponsePromise; constructor({ response, @@ -21,11 +22,11 @@ export class Page implements AsyncIterable { getItems, loadPage }: { - response: unknown; + response: R; rawResponse: RawResponse; - hasNextPage: (response: unknown) => boolean; - getItems: (response: unknown) => T[]; - loadPage: (response: unknown) => HttpResponsePromise; + hasNextPage: (response: R) => boolean; + getItems: (response: R) => T[]; + loadPage: (response: R) => HttpResponsePromise; }) { this.response = response; this.rawResponse = rawResponse; diff --git a/generators/typescript/utils/core-utilities/src/core/pagination/Pageable.ts b/generators/typescript/utils/core-utilities/src/core/pagination/Pageable.ts index 162c9ceae573..500392e080c8 100644 --- a/generators/typescript/utils/core-utilities/src/core/pagination/Pageable.ts +++ b/generators/typescript/utils/core-utilities/src/core/pagination/Pageable.ts @@ -11,8 +11,8 @@ export declare namespace Pageable { } } -export class Pageable extends Page { +export class Pageable extends Page { constructor(args: Pageable.Args) { - super(args as any); + super(args); } } diff --git a/seed/ts-sdk/pagination/src/core/pagination/Page.ts b/seed/ts-sdk/pagination/src/core/pagination/Page.ts index 1aa08e568fad..e710dcdc4255 100644 --- a/seed/ts-sdk/pagination/src/core/pagination/Page.ts +++ b/seed/ts-sdk/pagination/src/core/pagination/Page.ts @@ -4,15 +4,16 @@ import type { HttpResponsePromise, RawResponse } from "../fetcher/index.js"; * A page of results from a paginated API. * * @template T The type of the items in the page. + * @template R The type of the response object. */ -export class Page implements AsyncIterable { +export class Page implements AsyncIterable { public data: T[]; public rawResponse: RawResponse; + public response: R; - private response: unknown; - private _hasNextPage: (response: unknown) => boolean; - private getItems: (response: unknown) => T[]; - private loadNextPage: (response: unknown) => HttpResponsePromise; + private _hasNextPage: (response: R) => boolean; + private getItems: (response: R) => T[]; + private loadNextPage: (response: R) => HttpResponsePromise; constructor({ response, @@ -21,11 +22,11 @@ export class Page implements AsyncIterable { getItems, loadPage, }: { - response: unknown; + response: R; rawResponse: RawResponse; - hasNextPage: (response: unknown) => boolean; - getItems: (response: unknown) => T[]; - loadPage: (response: unknown) => HttpResponsePromise; + hasNextPage: (response: R) => boolean; + getItems: (response: R) => T[]; + loadPage: (response: R) => HttpResponsePromise; }) { this.response = response; this.rawResponse = rawResponse; diff --git a/seed/ts-sdk/pagination/src/core/pagination/Pageable.ts b/seed/ts-sdk/pagination/src/core/pagination/Pageable.ts index 5689e1e35025..458162f5edfb 100644 --- a/seed/ts-sdk/pagination/src/core/pagination/Pageable.ts +++ b/seed/ts-sdk/pagination/src/core/pagination/Pageable.ts @@ -11,8 +11,4 @@ export declare namespace Pageable { } } -export class Pageable extends Page { - constructor(args: Pageable.Args) { - super(args as any); - } -} +export class Pageable extends Page {}