Skip to content

decorator with overload incorrectly inserts Unknown into the decorated function's type #1821

@DetachHead

Description

@DetachHead

Summary

from typing import overload, Callable

@overload
def asdf(fn: Callable[[], str]) -> str: ...


@overload
def asdf(fn: Callable[[], None]) -> None: ...


def asdf(fn: Callable[[], str | None]) -> str | None:
    return ""


@asdf
def foo() -> None: ...


reveal_type(foo)  # expected: `None`, actual: `None | Unknown`

https://play.ty.dev/eef6acf1-7d7c-4114-8ab9-c6e7c308e0e5

Version

0.0.1-alpha.32

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcallsIssues relating to call-signature checking and diagnostics

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions