If you have an Array of object in TypeScript and it has a property used as a key and you need to remove an item from this array you can :

const index = myArray.indexOf(key, 0); // get the index of the item

then delete the element using the index

if (index > -1) {
   myArray.splice(index, 1);
}

Laisser un commentaire