def get_types(self, owner: type[Instance]) -> tuple[type, ...]:
        """Get the types of the descriptor.

        Args:
            owner: Class that owns the descriptor

        Returns:
            Tuple of valid types for this field

        Raises:
            TypeError: If types cannot be determined
        """
        try:
            types = get_args(get_type_hints(owner)[self.name])
            return get_args(types[0]) if hasattr(types[0], "__args__") else (types[0],)
        except (KeyError, TypeError, AttributeError) as e:
            msg = f"Unable to determine types for {self.name} in {owner}"
            raise TypeError(msg) from e
Get the types of the descriptor.

        Args:
            owner: Class that owns the descriptor

        Returns:
            Tuple of valid types for this field

        Raises:
            TypeError: If types cannot be determined
        
src/anomalib/data/dataclasses/generic.py