Type 'string' is not assignable to type 'any[]'

Hey everyone. One Problem and I don’t know what to do :frowning: I had search a while but don’t find solution:

This is my Code:

arrMedia = [];
 

  constructor(private navCtrl: NavController, private navParams: NavParams, private fdb: AngularFireDatabase) {      

    this.fdb.list('/kategorien').snapshotChanges().subscribe(item => {
      item.forEach(element => {
        this.arrMedia = element.key;
        
      })
    })

  }


And I become this error :slight_smile:
Type ‘string’ is not assignable to type ‘any

What can I do :frowning: Please help

this is more a vanilla JS error

your ArrMedia variable is of type Array
you element.key is of type string
you cant assign a string value to an array

try

arrMedia.push(element.key) //adds element.key to the end of the array

Thanks :slight_smile: I was a little stupid :smiley: