diff --git a/ogstools/meshlib/boundary_subset.py b/ogstools/meshlib/boundary_subset.py
index 6a7f7b6a2c5d2bdd9569c227d61bdd7bcd596826..ff8bb6d7c8d75e2172fcb7c669b310252f9b32af 100644
--- a/ogstools/meshlib/boundary_subset.py
+++ b/ogstools/meshlib/boundary_subset.py
@@ -5,6 +5,7 @@ from typing import Union
 import numpy as np
 import pyvista as pv
 from ogs import cli
+from typeguard import typechecked
 
 
 class Surface:
@@ -19,11 +20,8 @@ class Surface:
     def material_id(self) -> int:
         return self._material_id
 
-    def __init__(
-        self,
-        input: Union[Path, pv.DataSet],
-        material_id: int,
-    ):
+    @typechecked
+    def __init__(self, input: Union[Path, pv.DataSet], material_id: int):
         """Initialize a surface mesh. Either from pyvista or from a file."""
         self._material_id = material_id
 
@@ -37,11 +35,6 @@ class Surface:
             self.mesh = input
             self.filename = Path(tempfile.mkstemp(".vtu", "surface")[1])
             pv.save_meshio(self.filename, self.mesh, file_format="vtu")
-        else:
-            msg = "{} given, must be either Path or pyvista Dataset.".format(
-                self.filename
-            )
-            raise ValueError(msg)
 
         self.mesh.cell_data["MaterialIDs"] = (
             np.ones(self.mesh.n_cells) * self.material_id
diff --git a/ogstools/meshlib/data_processing.py b/ogstools/meshlib/data_processing.py
index eb6fa3614fa31ccd81705c8dd3adf78618e1a34b..9b65e77d4290694aaa75c9f83f2e701d81afbaff 100644
--- a/ogstools/meshlib/data_processing.py
+++ b/ogstools/meshlib/data_processing.py
@@ -3,6 +3,7 @@ from typing import Optional, Union
 
 import numpy as np
 import pyvista as pv
+from typeguard import typechecked
 
 from ogstools.propertylib import Property
 
@@ -85,7 +86,7 @@ def difference_pairwise(
     )
 
 
-# TODO: let this also return meshes and a property
+@typechecked
 def difference_matrix(
     meshes_1: Union[list, np.ndarray],
     meshes_2: Optional[Union[list, np.ndarray]] = None,
@@ -104,13 +105,7 @@ def difference_matrix(
                 or all datasets between meshes_1 and meshes_2 for all possible
                 combinations.
     """
-    if not isinstance(meshes_1, (list, np.ndarray)):
-        msg = "mesh1 is neither of type list nor np.ndarray"  # type: ignore[unreachable]
-        raise TypeError(msg)
     meshes_1 = np.asarray(meshes_1).flatten()
-    if not isinstance(meshes_2, (list, np.ndarray)) and meshes_2 is not None:
-        msg = "mesh2 is neither of type list nor np.ndarray."  # type: ignore[unreachable]
-        raise TypeError(msg)
     if meshes_2 is None:
         meshes_2 = meshes_1.copy()
     meshes_2 = np.asarray(meshes_2).flatten()
diff --git a/pyproject.toml b/pyproject.toml
index 3ff6c2b35b5de17b25187130b44fa71cb0efe18e..f1d5d22d80da6eaed0da382afff7be66300847ff 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -26,6 +26,7 @@ dependencies = [
   "ogs>=6.5.1.dev0",
   "ogs6py>=0.370",
   "tqdm>=4.60",
+  "typeguard>=4.0.0",
   "VTUinterface>=0.704",
 ]