from typing import Union


def check_positive_int(input_int: Union[str, int]) -> int:
    """Check if `input_int` is a positive integer.
    If it is, return it as an `int`. Raise `TypeError` otherwise
    """
    input_int = int(input_int)
    if input_int <= 0:
        raise ValueError(f"A positive integer is expected, got {input_int}")
    return input_int