from typing import List
from typing import Any
from typing import cast


def check_list_elements_are_strings(
    input: List[Any], failure_message: str
) -> List[str]:
    """
    Checks that all elements in a list are of the specified type, casting it upon
    success.
    """
    for ele in input:
        if not isinstance(ele, str):
            raise ValueError(failure_message)

    return cast(List[str], input)