``` py from typing import Optional MyType = Optional[int] def f(x: bool) -> MyType: pass ``` produces an error ``` x/invalidtype.py: note: In function "f": x/invalidtype.py:4: error: Invalid type "invalidtype.MyType" ``` A type synonym for `Union[str, int]` works fine.