Some of the packages I use don't type hint their code, so when I use them, Pylance keeps telling me that the functions I use have partially unknown types, which is a problem I can't fix. Is there a way to disable such errors?
# type: ignore
Place this comment at the top of a file to ignore all type-checking errors in the file.
Similarly, place it at the end of a line to just ignore errors on that line.
When I come across a third-party package that doesn't provide typing information, I generally make a wrapper for it, in a file on its own, and use that wrapper from the rest of my codebase - this allows me to just use the per-file ignore, while minimising the amount of code that has to have type-checking disabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With