Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error TS2345: Argument of type 'IQuestion[] | null' is not assignable to parameter of type 'Collection<unknown>'. #392

Open
giovannidias1 opened this issue Jul 11, 2022 · 2 comments

Comments

@giovannidias1
Copy link

=======

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;

@michaelbromley
Copy link
Owner

Hi, can you create a minimal reproduction of this?

@naveendharnamoni
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants