Fix interaction of class_alias() with exceptions and typehints