code: def test_connect_non_compatible_types(from_type, to_type):
      comp1 = factory.component_class(
          "Comp1", output_types={"value": from_type}
      )()
      comp2 = factory.component_class(
          "Comp2", input_types={"value": to_type}
      )()
  
      pipe = Pipeline()
      pipe.add_component("c1", comp1)
      pipe.add_component("c2", comp2)
  
      with pytest.raises(
          PipelineConnectError,
          match="Cannot connect 'c1.value' with 'c2.value': their declared input and output types do not match.",
      ):
          pipe.connect("c1", "c2")
  
imports: from typing import List, Set, Sequence, Tuple, Dict, Mapping, Literal, Union, Optional, Any
  from enum import Enum
  import re
  from pathlib import Path
  import pytest
  from haystack.core.pipeline import Pipeline
  from haystack.core.errors import PipelineConnectError
  from haystack.testing import factory
  from haystack.core.component.connection import parse_connect_string
  from haystack.testing.sample_components import AddFixedValue
label_desc: Use image node_id 2 for calling a global function with example usage: test_connect_non_compatible_types(from_type, to_type) without return types