'Angular pagination is not throwing error - is not assignable to parameter of type 'Collection<unknown>'

I am using Angular pagination. I am getting below error. I am not sure what is the issue here.

I installed - import { NgxPaginationModule } from 'ngx-pagination'; and add to the imports

I need help to solve this error. Thank you

Argument of type 'Highway[] | undefined' is not assignable to parameter of type 'Collection<unknown>'.

Code

<tr
                  *ngFor="
                    let highway of highways
                      | paginate
                        : {
                            itemsPerPage: 10,
                            currentPage: page,
                            totalItems: totalRecords
                          }
                  "
                ></tr>
        <pagination-controls (pageChange)="page = $event"></pagination-controls>

.ts file

export class HighwaysPageComponent implements OnInit {
  highways?: Highway[];
  favoritesList?: FavoriteDetails[];
  totalRecords: number = 10;
  page: number = 1;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source