Get field type in templates
There might be other ways, but here's one possibility:
{{ craft.app.fields.getFieldByHandle('yourFieldHandle').className() }}

This will return a string of craft\fields\PlainText, craft\fields\Lightswitch etc, which you can then use in conditionals/switch statements.