function insertAt insertAt<T extends { id: string; }>(list: T[],item: T,idx: number): T[] Returns list with item at idx, or at the end when the list has since shrunk below it, unless the list holds it already. Type Parameters T extends { id: string; } Parameters list: T[] item: T idx: number Return Type T[]