error 'paginationRange.length' is possibly 'undefined'.ts(18048)export type IPaginate = {
totalCount: number
pageSize: number
siblingCount: number
currentPage: number
onPageChange?: () => void
}paginateHook.ts export const usePagination = ({totalCount, pageSize, siblingCount = 1, currentPage}: IPaginate) => {
// do something here
}UsePaginate.tsx const paginationRange = usePagination({
currentPage,
totalCount,
siblingCount,
pageSize
})if ( currentPage === 0 || paginationRange?.length < 2){ // 'paginationRange.length' is possibly 'undefined'.ts(18048)
return null
}