Yes. You can typecast your function using & for function overloading.
--!strict
local module = {}
module.foo = function(a: any, b: any): ()
if typeof(a) ~= typeof(b) then
error(`invalid argument(s)`, 2)
end
-- code
end :: ((a: string, b: string) -> ()) & ((a: number, b: number) -> ())
module.foo(1, 2)
module.foo("a", "b")
-- type error
module.foo(1, "b")
-- type error
module.foo("a", 2)
return module