Skip to content

removePropertiesFromArrayObjects

Function that, given an array of objects and a property or an array of properties, return a new array without specified properties.

Types

RemovePropertiesFromArrayObjectsProps

  • @template T - The type of the objects in the array.
  • @template E - The type of the property key(s) to remove. Defaults to keyof T.

Parameters accepted by removePropertiesFromArrayObjects.

PropertyTypeRequiredDescription
arrayT[]The array of objects from which properties should be removed.
propertyE \| E[]A single property key or an array of property keys to omit from each object in array.

RemovePropertiesFromArrayObjectsResult

  • @template T - The original object type.
  • @template E - The omitted property key type.

Return value of removePropertiesFromArrayObjects.

An array of objects of the same type as the input, with the specified property or properties omitted from each element.

ts
export type RemovePropertiesFromArrayObjectsResult<T, E extends string | number | symbol = keyof T> = Omit<T, E>[];

Released under the MIT License.