diff --git a/src/backend/langflow/interface/custom/custom_component.py b/src/backend/langflow/interface/custom/custom_component.py index c1de48a98..74d06215f 100644 --- a/src/backend/langflow/interface/custom/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component.py @@ -49,7 +49,9 @@ class CustomComponent(Component, extra=Extra.allow): reader = DirectoryReader("", False) for type_hint in TYPE_HINT_LIST: - if reader.is_type_hint_used_but_not_imported(type_hint, code): + if reader._is_type_hint_used_in_args( + "Optional", code + ) and not reader._is_type_hint_imported("Optional", code): error_detail = { "error": "Type hint Error", "traceback": f"Type hint '{type_hint}' is used but not imported in the code.",