protected function typeExists(Index $index, $typeName)
    {
        Assertion::minLength($typeName, 1, 'Type name must be at least one char long');

        // The index mapping contains a list of all registered types
        $mapping = $index->getMapping();

        return !empty($mapping[$index->getName()][$typeName]);
    }