code: function WrappedUnionType(attrs, opts) {
    UnionType.call(this, attrs, opts);
  
    this._constructors = this._types.map(function (type) {
      // jshint -W054
      var name = type.getName(true);
      if (name === 'null') {
        return null;
      }
  
      function ConstructorFunction(name) {
        return function Branch$(val) {
          this[`${name}`] = val;
        }
      }
      var constructor = ConstructorFunction(name);
      constructor.getBranchType = function() { return type; };
      return constructor;
    });
  }
docs: Compatible union type.
  
  Values of this type are represented in memory similarly to their JSON
  representation (i.e. inside an object with single key the name of the
  contained type).
  
  This is not ideal, but is the most efficient way to unambiguously support
  all unions. Here are a few reasons why the wrapping object is necessary:
  
  + Unions with multiple number types would have undefined behavior, unless
  numbers are wrapped (either everywhere, leading to large performance and
  convenience costs; or only when necessary inside unions, making it hard to
  understand when numbers are wrapped or not).
  + Fixed types would have to be wrapped to be distinguished from bytes.
  + Using record's constructor names would work (after a slight change to use
  the fully qualified name), but would mean that generic objects could no
  longer be valid records (making it inconvenient to do simple things like
  creating new records).