is is a kind of macro and can't take right variable arguments.
Also, there are no available GDScriptNativeClass methods to do some instrospection like getting class name of a GDScriptNativeClass var like in following, that you would pass as argument to your is_type function
var a_type = SpatialMaterial
But that would be rewriting is, itself anyway.
Without more context, something like this could do the job as, i suppose, you want to store types somewhere
func _ready():
var foo = SpatialMaterial.new()
print(is_type(foo, "SpatialMaterial"))
print(is_type(ColorN("red", 1), TYPE_COLOR))
func is_type(res, type) -> bool:
if type is String:
return res is Object and res.get_class() == type
return typeof(res) == type