Open
Description
Feature
As I explained in the title.
Pitch
Currently this raises an error:
from typing import TYPE_CHECKING, overload
if TYPE_CHECKING:
@overload # E: An overloaded function outside a stub file must have an implementation
def f(x: int) -> str:
...
@overload
def f(x: str) -> bytes:
...
I think that if code is in if TYPE_CHECKING
then it shouldn't need an implementation though.
Activity
Avasam commentedon May 30, 2025
Isn't
TYPE_CHECKING
meant to be transparent to type-checkers? The above can be done as:mypy doesn't really know either if you meant the above, or if you legitimately misplaced your overloads/forgot the implementation:
A5rocks commentedon May 30, 2025
I mean maybe it's supposed to be transparent?
I think empty body errors get disabled in there. I think in general it should be treated more like stubs.
uko3211 commentedon May 30, 2025
checker.py
According to the comment on that line, it seems the error for this case was intended not to be shown.