I had the following mysterious error when looping over an API call and populating an array:
Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'push')
Declaration was at first:
bookIds!: any[];
This error occurs in angular when you didn't initialise the array blank.
Initialize an empty one:
bookIds: any = [ ];