使用带有调用签名的对象字面量来定义泛型函数
interface IGenericIdentityFn1 {
}function identity<T>(arg: T): T { return arg;
}const myIdentityFn: {<T>(arg: T): T} = identity;const myIdentityFn2: IGenericIdentityFn1 = identity;这里两种方式都报错
ERROR:
callable-types: Type literal has only a call signature — use <T>(arg: T) => T instead
请问需要怎么解决。
慕虎7371278
缥缈止盈
随时随地看视频慕课网APP
相关分类