code: function getUnionTypeFromSortedList(types, aliasSymbol, aliasTypeArguments) {
              if (types.length === 0) {
                  return neverType;
              }
              if (types.length === 1) {
                  return types[0];
              }
              var id = getTypeListId(types);
              var type = unionTypes[id];
              if (!type) {
                  var propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 6144 /* Nullable */);
                  type = unionTypes[id] = createObjectType(524288 /* Union */ | propagatedFlags);
                  type.types = types;
                  type.aliasSymbol = aliasSymbol;
                  type.aliasTypeArguments = aliasTypeArguments;
              }
              return type;
          }
docs: This function assumes the constituent type list is sorted and deduplicated.