export const mergeItems = (keyExtractor, oldItems, newItems) =>
uniqBy(oldItems.concat(newItems), keyExtractor)
What is keyExtractor? What are old and new items? You can probably guess that oldItems and newItems are an array of something, and you can probably infer from names and stuff that keyExtractor should extract a key from the items somehow, but aside from that you don't have much. If you didn't know what the lodash function "uniqBy" does, you wouldn't know how to use this without research.Contrast that with this below (Javascript with Flow type annotations):
export const mergeItems = <Item> (
keyExtractor: (value: Item) => string,
oldItems: Array<Item>,
newItems: Array<Item>,
): Array<Item> => uniqBy(oldItems.concat(newItems), keyExtractor)
With types it is a lot more explicit. Key extractor is given the item in the array, and should return a string key. Now you don't need to know or care about how "uniqBy" works, or the exact details of how you should or shouldn't use it, and if you try to pass 2 arrays with different items, it will yell at you because that's not right, something that type inference can't determine (at least not with Flow's typesystem)