* Groups an array of objects by a specific key.
 * @template Obj - The type of the objects in the array, which must extend `Record<string, unknown>`.
 * @template GroupedObject - The type of the object that groups the array, which must extend `Partial<{ [K in Obj[keyof Obj]]: Obj[] }>`.
 * @param {Obj[]} arr - The array of objects to group.
 * @param {keyof Obj} key - The key to group the objects by.
 * @returns {GroupedObject} - An object that groups the array by the specified key.
  Obj extends Record<string, unknown>,
  Value extends Obj[Key] & (string | number),
  GroupedObject extends Partial<{ [K in Value]: Obj[] }>,
        [element[key] as string]: [
          ...(grouped[element[key] as string] || []),