from typing import Optional


def idna_to_ascii(domain: str) -> Optional[str]:
    """
    Convert an Internationalized Domain Name (IDN) into a Punycode string.
    Return `None` if the `domain` is invalid.

    >>> idna_to_ascii('日本語.jp')
    'xn--wgv71a119e.jp'
    """
    try:
        return domain.encode('idna').decode('ascii')
    except Exception:
        return None