def METHOD_NAME(
    cls, types: Sequence[cst.BaseElement]
) -> cst.BaseExpression:
    type_names = [t.value for t in types]
    if not all(isinstance(t, cst.Name) for t in type_names):
        raise ValueError("Only names are supported for now")
    expression = " | ".join(name.value for name in type_names)  # type: ignore
    return cst.parse_expression(expression)