from typing import Union
class A:
def __init__(self, a): ...
Test1 = str | A # error
Test2 = Union[str, A]
main.py:5: error: Expression type contains "Any" (has type "Type[A]")
But no error on the last line
https://mypy-play.net/?mypy=latest&python=3.10&flags=disallow-any-expr&gist=dd6dcaf336fb58d4afc3310200259630