Returns whether this node has the given trait.
bool $hasTrait(Type trait) => $traits.contains(trait);