Hi! 👋
We areusing trojs/paginator (^3.1.8) and noticed that the current JSDoc typedefs don’t fully support generics. Right now, items is typed as object[] which makes type inference any and doesn’t carry through the item type to Pagination.data.
It would be great if trojs/paginator supported generic types so that TypeScript (or editors with JSDoc support) could infer the type of items and pagination objects correctly. For example:
/**
* @template T
* @typedef {Object} Pagination
* @property {PaginationLinks} cursors
* @property {number} count
* @property {number} pages
* @property {number} size
* @property {number|null} page
* @property {T[]} items
*/
and
/**
* @template T
* @returns {Paginator<T>}
*/
const PaginatorBuilder = ({ items, page, size, count, url, sortColumn, sortDirection }) => { ... }
/** @type {Pagination<InvoiceType>} */
const result = Paginator({
items: invoices,
page,
size,
count
}).data
Would you consider adding this generic support to trojs/paginator?
Thanks! 🙏
Hi! 👋
We areusing trojs/paginator (^3.1.8) and noticed that the current JSDoc typedefs don’t fully support generics. Right now, items is typed as object[] which makes type inference any and doesn’t carry through the item type to Pagination.data.
It would be great if trojs/paginator supported generic types so that TypeScript (or editors with JSDoc support) could infer the type of items and pagination objects correctly. For example:
and
Would you consider adding this generic support to trojs/paginator?
Thanks! 🙏