通过使用call来调用返回泛型的函数时会丢失返回值的类型,有什么解决办法吗
function test<T>(arg: T): T {
return arg;
}
let a = test.call(null, "a"); // unknow
let b = test("b"); // string
通过使用call来调用返回泛型的函数时会丢失返回值的类型,有什么解决办法吗
function test<T>(arg: T): T {
return arg;
}
let a = test.call(null, "a"); // unknow
let b = test("b"); // string
0 Commentaires