TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' [duplicate]
str | None syntax is only supported in 3.10 or later. Use from typing import Optional name: Optional[str] = None For cases where the right hand side isn't None or there are more than two types, you can use Union from typing import Union foo: Union[str, int, float] = "bar"