Run-time behaviour of `TypeAliasType

Thanks for the explanation, it’s exactly what I wanted to see.

I still disagree that these special cases shouldn’t be supported (we do have support for isinstance and issubclass checks for UnionAlias after all), but if we’re not going to support them I think it should be explicitly stated as part of the typing spec, and the error messages for these actions should also be improved as they are kind of confusing to me at least.

>>> isinstance("abc", NewAlias)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

It looks weird that a type alias is not a type.
I don’t think this is error any less confusing than the two cases you listed.
I’ve been using Python for 7 years and would consider myself an advanced user, and while I would be able to diagnose the error fairly quickly the messages aren’t of much help atm.
My conclusion is that both cases are fairly confusing and we have to choose what confusion we want, but I will admit that you’ll probably find the current error earlier and that possibly makes the debugging experience nicer.

Once again, to reiterate, I’m happy with any conclusion we draw as long as this is document carefully. Even if I disagree with the decision made.