def does_obj_satisfy_typed_dict(obj: Any, cls: GenericType) -> bool:
    """Check if an object satisfies a typed dict.

    Args:
        obj: The object to check.
        cls: The typed dict to check against.

    Returns:
        Whether the object satisfies the typed dict.
    """
    if not isinstance(obj, Mapping):
        return False

    key_names_to_values = get_type_hints(cls)
    required_keys: frozenset[str] = getattr(cls, "__required_keys__", frozenset())

    if not all(
        isinstance(key, str)
        and key in key_names_to_values
        and _isinstance(value, key_names_to_values[key])
        for key, value in obj.items()
    ):
        return False

    # TODO in 3.14: Implement https://peps.python.org/pep-0728/ if it's approved

    # required keys are all present
    return required_keys.issubset(required_keys)
Check if an object satisfies a typed dict.

    Args:
        obj: The object to check.
        cls: The typed dict to check against.

    Returns:
        Whether the object satisfies the typed dict.
    
reflex/utils/types.py