If I have an example function like this: def foo[T: int | str](typ: type[T]) -> T: ... and I call it like this: foo(int) # return type is therefore -> int My type checker (Pylance) can't infer that the return type of this function is int. From what I have read I'm pretty sure this is intentional, but I'm wondering if there is a workaround. Continue reading...