-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionenhancement requestNew feature or requestNew feature or request
Description
Describe the bug
None cannot be assigned to typing.Hashable. None is hashable in Python.
To Reproduce
Type check the snippet below.
Expected behavior
That None would be accepted as a value of type Hashable.
Screenshots or Code
from typing import Dict, Hashable
# Expression of type "None" cannot be assigned to declared type "Hashable"
# Type "None" cannot be assigned to type "Hashable"
foo: Hashable = None
# Expression of type "dict[None, str]" cannot be assigned to declared type "Dict"
# TypeVar "_KT" is invariant
# Type "None" cannot be assigned to type "Hashable"
bar: Dict[Hashable, str] = {None: ''}
# True
isinstance(None, Hashable)VS Code extension or command-line
Extension, 1.1.65
Metadata
Metadata
Assignees
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionenhancement requestNew feature or requestNew feature or request