Skip to content

Function: Paginated()

ts
function Paginated<T>(ItemType): AnyConstructor;

Defined in: packages/apollo/src/pagination.ts:46

Creates a simple paginated response type for a given item class. Fields: items, total, hasNextPage, hasPreviousPage.

Type Parameters

Type Parameter
T

Parameters

ParameterType
ItemTypeConstructor<T>

Returns

AnyConstructor

Example

typescript
@ObjectType()
class BooksPage extends Paginated(Book) {}

@Query(() => BooksPage)
books(@Args() args: BooksArgs): BooksPage { ... }

Released under the MIT License.