Question
How do I get Pylance to ignore the possibility of None?
I love Pylance type checking.
However, If I have a variable var: Union[None, T]
, where T
implements foo
, pylance will throw an error at:
var.foo()
since type None
doesn't implement foo
.
Is there any way to resolve this? A way to tell Pylance "This variable is None
sometimes but in this case I'm 100% sure it will be assigned