docs: function getUnionType(types, subtypeReduction, aliasSymbol, aliasTypeArguments) {
              if (types.length === 0) {
                  return neverType;
              }
              if (types.length === 1) {
                  return types[0];
              }
              var typeSet = [];
              addTypesToUnion(typeSet, types);
              if (typeSet.containsAny) {
                  return anyType;
              }
              if (subtypeReduction) {
                  removeSubtypes(typeSet);
              }
              if (typeSet.length === 0) {
                  return typeSet.containsNull ? typeSet.containsNonWideningType ? nullType : nullWideningType :
                      typeSet.containsUndefined ? typeSet.containsNonWideningType ? undefinedType : undefinedWideningType :
                          neverType;
              }
              return getUnionTypeFromSortedList(typeSet, aliasSymbol, aliasTypeArguments);
          }