code: function createUnionTypeAnnotation(types) {
    var flattened = removeTypeDuplicates(types);
  
    if (flattened.length === 1) {
      return flattened[0];
    } else {
      return t.unionTypeAnnotation(flattened);
    }
  }
docs: Takes an array of `types` and flattens them, removing duplicates and
  returns a `UnionTypeAnnotation` node containg them.