使用帶有調用簽名的對象字面量來定義泛型函數(shù)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請問需要怎么解決。
typescript 泛型調用簽名的對象字面量來定義泛型函數(shù)報錯
慕虎7371278
2019-02-06 21:41:17