How to get all Fields of specific FieldType?
You code is OK, only that you are trying to read the protected property field_type. Instead use the method:

$field-&gt;getType()


Reference: public function FieldDefinitionInterface::getType()