Pyright currently will raise a warning if you try and do an isinstance check on a typed dict, however it will not do the same if you try and pattern match on typed dictionaries:
from typing import TypedDict
class User(TypedDict):
name: str
age: int
class AdminUser(User):
is_admin: bool
def process_users(users: list[User | AdminUser]):
for user in users:
match user:
case AdminUser(): # No warning, runtime error
print("admin user")
case User():
print("standard user")
isinstance(User(name="Max", age=25), User) # Raises a warning
Pyright currently will raise a warning if you try and do an
isinstance
check on a typed dict, however it will not do the same if you try and pattern match on typed dictionaries:Pyright Playground