diff --git a/hamilton/function_modifiers/expanders.py b/hamilton/function_modifiers/expanders.py index 0cfe1ea62..d3401eac1 100644 --- a/hamilton/function_modifiers/expanders.py +++ b/hamilton/function_modifiers/expanders.py @@ -768,6 +768,7 @@ def _determine_fields_to_extract( for field in fields: if field not in typed_dict_fields: errors.append(f"{field} is not a field in the `TypedDict` {output_type}.") + continue reduced_fields[field] = typed_dict_fields[field] fields = reduced_fields elif isinstance(fields, dict): diff --git a/tests/function_modifiers/test_expanders.py b/tests/function_modifiers/test_expanders.py index fa11b5c05..09946e4f1 100644 --- a/tests/function_modifiers/test_expanders.py +++ b/tests/function_modifiers/test_expanders.py @@ -396,6 +396,7 @@ def function() -> return_type: # type: ignore ("np.ndarray", {"A": int}), ("pd.DataFrame", {"A": int}), ("MyDictBad", {"A": int}), + ("MyDict", (["test", "not_a_field"])), ("MyDictInheritanceBadCase", {"A": SomeObject}), ("dict", ("A", "B")), ("dict", (["A", "B"])),