ngx-pagination
ngx-pagination copied to clipboard
error TS2345: Argument of type 'IQuestion[] | null' is not assignable to parameter of type 'Collection<unknown>'.
=======
Angular version: 13..3.2
ngx-pagination version: 6.0.2
Description of issue: I trying to add psgintion with return of store
Steps to reproduce: just add paginate pipe
Expected result: items
Actual result: error
Any relevant code:
<app-question-card
*ngFor="
let question of questions$
| async
| paginate
: {
id: 'custom',
itemsPerPage: 10,
currentPage: 1,
totalItems: 100
}
"
[question]="question"></app-question-card>
// ts of ngfor
questions$: Observable<IQuestion[]> = new Observable();
[...]
this.questions$ = this.store.select(selectRecentsQuestionsAnswers);
// app-question-card question input
@Input() question!: IQuestion;
Hi, can you create a minimal reproduction of this?
I have fixed this issue by adding a non-null assertion operator in Typescript. you can add the '!' operator at the end of your array or collection. Example: let question of questions!
Another way is by turning off strictNullChecks in your tsconfig.json