on-internet
← Community

Why is reveal_type() recognised without import, but not assert_type() or assert_never()?

Stack Overflow ·

typing.reveal_type() notes that: Most type checkers support reveal_type() anywhere, even if the name is not imported from typing. [...] But the same isn't true for typing.assert_type() and typing.assert_never. For example, with Pyright: reveal_type assert_type # Error: "assert_type" is not defined assert_never # Error: "assert_never" is not defined Why don't type checkers support these two names without import?

Comments

Sign in or sign up to comment and upvote.

No comments yet.