Skip to content

Commit

Permalink
Add typing_extensions.assert_type (#7627)
Browse files Browse the repository at this point in the history
Hasn't been released yet but I'd like it to be in the next mypy release.
  • Loading branch information
JelleZijlstra authored Apr 15, 2022
1 parent e0654bd commit d09689f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion stdlib/typing_extensions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ __all__ = [
"SupportsIndex",
"Annotated",
"assert_never",
"assert_type",
"dataclass_transform",
"final",
"IntVar",
Expand Down Expand Up @@ -186,12 +187,19 @@ else:

# New things in 3.11
if sys.version_info >= (3, 11):
from typing import Never as Never, Self as Self, assert_never as assert_never, reveal_type as reveal_type
from typing import (
Never as Never,
Self as Self,
assert_never as assert_never,
assert_type as assert_type,
reveal_type as reveal_type,
)
else:
Self: _SpecialForm
Never: _SpecialForm
def reveal_type(__obj: _T) -> _T: ...
def assert_never(__arg: NoReturn) -> NoReturn: ...
def assert_type(__val: _T, __typ: Any) -> _T: ...

# Experimental (hopefully these will be in 3.11)
Required: _SpecialForm
Expand Down

0 comments on commit d09689f

Please sign in to comment.