You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to tracking issue python/mypy#5818, assert_never was introduced in typing_extensions version 4.1.0. At runtime, this clearly seems to work, which I can verify via:
However if I type check the code with mypy it complains at the line of the import:
error: Module "typing_extensions" has no attribute "assert_never"
I'm not sure if this an issue with typing_extensions or mypy though.
In any case, assert_never is supposed to have runtime behavior (to raise an assertion), i.e., it is not something that is supposed to be hidden behind a TYPE_ASSERTION barrier.
The text was updated successfully, but these errors were encountered:
The issue is that mypy uses typing_extensions.pyi in typeshed for typing_extensions, so if something is missing from the typeshed stub for typing_extensions, mypy doesn't know about it, even if it exists at runtime. Mypy <=0.942 uses an out-of-date version of the typeshed stub.
According to tracking issue python/mypy#5818,
assert_never
was introduced intyping_extensions
version 4.1.0. At runtime, this clearly seems to work, which I can verify via:python -c "from typing_extensions import assert_never"
However if I type check the code with mypy it complains at the line of the import:
I'm not sure if this an issue with
typing_extensions
or mypy though.In any case,
assert_never
is supposed to have runtime behavior (to raise an assertion), i.e., it is not something that is supposed to be hidden behind aTYPE_ASSERTION
barrier.The text was updated successfully, but these errors were encountered: