assigned function declaration in unity javascript for different types

In defining functions as function objects like this:

var firstone = function(a,b){
	return a;
};
var addition = function(a,b){
	return a + b;
};

firstone(1,2); // returns 1, as expected

Error occurs for addition: BCE0051: Operator ‘+’ cannot be used with a left hand side of type ‘Object’ and a right hand side of type ‘Object’.

Explicitly declaring the parameters as integer works:

var addition = function(a:int,b:int){
	return a + b;
};

However, is there a way to generalize this to work for floats and other data types?

I don’t know if it works with javascript, but with C# you can work with templates, which would make that possible.
C# reference: 1

Maybe you find someting for javascript