from typing import Optional
from typing import Union


def optional_int(value: Optional[Union[int, str]]) -> Optional[int]:
    """
    Convert an Optional string/int into an Optional[int].
    """
    if value is None or value == "":
        return None

    return int(value)