Skip to content

overloads in if TYPE_CHECKING shouldn't require implementations #19169

Open
@A5rocks

Description

@A5rocks

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions