kit
    Preparing search index...
    • Add or replace an item in the given array, it returns a new array (immutable). Typescript wise this is meant to keep the same type on the newly returned array, therefore the newItem must match the type of the list items.

      Type Parameters

      • T

      Parameters

      • list: T[]

        The original array to modify.

      • newItem: T

        The item to add or replace.

      • OptionalnewIdx: number

        The index at which to replace the item (if defined).

      Returns T[]

      A new array with the item added or replaced.