Hello there, I was wondering if you see in future the python type system being able to allow creating types from function call.
I'm asking this because I've designed an API for a library that doesn't really work well with the type system at the moment[1].
It looks something like this:
```python
def union(
name: str, types: Tuple[Types, ...], *
) -> Union[Types]:
# implementation is not important
return None # type: ignore
```
and it can be used like so:
```python
UserOrError = union("UserOrError", (User, Error))
x: UserOrError = User(name="Patrick")
```
We do this to add some information about the type (for example a name), but running a type checker
on the code above gives you this error:
> Illegal type annotation: variable not allowed unless it is a type alias
My question was, should I deprecate this way of creating a custom type in favour of using, maybe annotated?
So the users code would look like this?
```python
UserOrError = Annotated[User | Error, union(name="UserOrError")]
x: UserOrError = User(name="Patrick")
```
or maybe there's some plan to support creating types from function calls (or expressions in general, when they can be statically analysed)?
This looks a bit more complicated, but I don't mind it too much.
[1] we made it work for Mypy via a plugin.