I am giving the generic type to the function parameter, when I call the function it gives me an error "This expression is not callable. Type unknown has no call signature"
function a() { return 'abc' }
function fun<T>(x: T, y: string) {
return x() + y;
}
fun(a, "str")
As written in this answer https://stackoverflow.com/a/62233415/3262937 you should use T extends Function so that the Typescript compiler knows that you generic parameter is a Function.
There is the solution.
function a() { return 'abc' }
function fun<T>(x: T, y: string) {
return x + y;
}
fun(a(), "str");