code: function removeTypesFromUnionOrIntersection(type, typesToRemove) {
              var reducedTypes = [];
              for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
                  var t = _a[_i];
                  if (!typeIdenticalToSomeType(t, typesToRemove)) {
                      reducedTypes.push(t);
                  }
              }
              return type.flags & 524288 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);
          }
docs: Return a new union or intersection type computed by removing a given set of types
  from a given union or intersection type.