Describe the bug
See the code below. Pyright detects the type for users to be Dict[int, str] even though it's Dict[int, UserType].
To Reproduce
from typing import Callable, Dict
from typing_extensions import Literal
UserType = Literal["User", "Admin"]
def print_user_type(user_type: UserType):
print(user_type)
def run(fn: Callable[[], Dict[int, UserType]]):
users = fn()
for user_id, user_type in users.items():
print_user_type(user_type)
Expected behavior
No pyright issues in the code above.
Thanks for the bug report. This will be fixed in the next published version of pyright.
This is now fixed in version 1.1.33, which I just published.
Most helpful comment
This is now fixed in version 1.1.33, which I just published.