Showing a message for specific content type
$node-&gt;type is a reference to the node type config entity - it's not a string.

You can use NodeInterface::getType() instead, e.g.:

if ($view_mode == 'full' &amp;&amp; $node-&gt;getType() == 'test_content') {

}


Incidentally you could also use $node-&gt;bundle(), or even $node-&gt;type-&gt;entity-&gt;id(). But getType() is probably most appropriate for your specific needs.

You also have the function signature wrong - it should be:

function test_module_node_view(array &amp;$build, \Drupal\node\NodeInterface $node, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode)