将通用功能分配给通用接口

时间:2017-01-20 09:09:57

标签: typescript

为什么下面的代码没有给我错误?

为什么Typescript允许我将具有不同调用签名的泛型函数分配给泛型接口?

interface GenerationIndentityFn{
    <T, U>(args1: T, arg2: U): T;
}

function identityf<T>(arg: T): T {
    return arg;
}
let myfunc: GenerationIndentityFn = identityf;  // no error

0 个答案:

没有答案
相关问题