pytypes icon indicating copy to clipboard operation
pytypes copied to clipboard

please improve error messages when functions decorated with @typechecked are called with incorrect types

Open sg-s opened this issue 3 years ago • 0 comments

this is what my function looks like:

@typechecked
def my_func(
    a: int,
    b: str,
):

I (deliberately) call the function with an incorrect type using:

my_func(1,1)

and I get this cryptic error message:

  called with incompatible types:
Expected: Tuple[int, str]
Received: Tuple[int, int]

this is not very helpful because it doesn't flag the variable that is causing the problem, that is failing the type check.

sg-s avatar Dec 22 '21 18:12 sg-s