function mapBy mapBy<T,Key extends keyof T,V,>(key: Key,valueFrom: (item: T) => V,): unknown Index items by one field and chosen value. Keys keep first-occurrence order, while later matching items replace the stored value. Type Parameters T Key extends keyof T V Parameters key: Key valueFrom: (item: T) => V Return Type unknown