function mergeDuplicateTypesAndReturnDedupedList(typeDefs) {
  const clonedDefs = cloneDeep(typeDefs)

  const newList = []

  for (const def of clonedDefs) {
    if (!def) {
      continue
    }

    const duplicateDefs = clonedDefs.filter(
      d => d.config.name === def.config.name
    )

    const newDef = {}

    for (const dDef of duplicateDefs) {
      merge(newDef, dDef)
    }

    newList.push(newDef)
  }

  return newList
}
This is an expensive fn but it doesn't matter because it's only to show a debugging warning message when something is wrong.