Add overload to cast for objects (#4851)

Fixes #4810
This commit is contained in:
Nils K
2020-12-28 08:46:26 +01:00
committed by GitHub
parent 2cb6b14834
commit a3c9392331
2 changed files with 4 additions and 0 deletions

View File

@@ -460,6 +460,8 @@ def get_type_hints(
def cast(tp: Type[_T], obj: Any) -> _T: ...
@overload
def cast(tp: str, obj: Any) -> Any: ...
@overload
def cast(tp: object, obj: Any) -> Any: ...
# Type constructors

View File

@@ -633,6 +633,8 @@ if sys.version_info >= (3, 8):
def cast(typ: Type[_T], val: Any) -> _T: ...
@overload
def cast(typ: str, val: Any) -> Any: ...
@overload
def cast(typ: object, val: Any) -> Any: ...
# Type constructors