import { DescendantsList } from '../Descendants.types'; /** * Returns a new descendants list with updated indexes. * * Call this after inserting/removing from the descendants list */ export const refreshDescendantIndexes = ( descendants: DescendantsList, ): DescendantsList => { return descendants.map((d, i) => ({ ...d, index: i })); };