> Though I wonder how to represent `Union[bytes, str]?` using the | syntax. `(bytes | str)?` or `bytes? | str?`
Good question! From the theoretical point of view, all your examples should be equal.
Since Union always maintains its structure.
Currently, it works correctly:
```
from typing import Optional, Union
x: Optional[Union[int, str]]
y: Union[Optional[int], Optional[str]]
reveal_type(y) # Union[
builtins.int, None, builtins.str, None]
```
However, mypy can possibly flatten repeating `None` values, but that's another topic.