Referencing "type" in nodes returned by loadMultiple(); I know there are easier ways to sort nodes by type, using views, or using:

$query-&gt;loadByProperties(['type' =&gt; 'my_content_type']);


... but what I really want to do is return ALL nodes and then do different things based on the type field, like so:

$result = \Drupal::entityQuery('node')-&gt;execute();
$nodes = \Drupal::entityTypeManager()-&gt;getStorage('node')-&gt;loadMultiple($result);

foreach ( $nodes as $node ) {
  if ( $node-&gt;type == "my_content_type" ) {

    // do something...

  } else {

    // do something else...

  }
}


However, my condition is never getting met, so I can only conclude that I am referencing the node type incorrectly. What am I doing wrong?
Thanks @berramou the solution is to use:

if ( $node-&gt;bundle() == "my_content_type" ) { ... }


Solved!