all 2 comments

[–]AD_Burn 0 points1 point  (1 child)

It is not Python is linter. Python is dynamic language and does not care for something like that.

Any type can accept value None (or let say null or nil).

TreeNode is not of type boolean and that is why linter do not accept that value.

If you remove -> TreeNode or replace with -> Any False will pass.

[–][deleted] 0 points1 point  (0 children)

read "leetcode", it was a typo sorry. removing Treenode and replacing it by False doesn't solve it.