如何使用typescript接口理解这个currying函数
我想我懂一点。我对响应中的=感到困惑:any=>ITest=response 有人能解释一下吗 多一点代码如何使用typescript接口理解这个currying函数,typescript,ecmascript-6,Typescript,Ecmascript 6,我想我懂一点。我对响应中的=感到困惑:any=>ITest=response 有人能解释一下吗 多一点代码 export interface ITest { type: string; payload: any; } export const callApi: (response: any) => ITest = (response) => ({ type: 'CALL_API', payload: response }); 更新1: 我试着一步一
export interface ITest {
type: string;
payload: any;
}
export const callApi: (response: any) => ITest = (response) => ({
type: 'CALL_API',
payload: response
});
更新1:
我试着一步一步地写,对吗
export const callApi: (response: any) => ITest
那么这会分配给接口吗
(response) => ({
type: 'CALL_API',
payload: response
})
=用于在本例中为变量callApi分配一个函数值。就这样。没有别的了这里没有咖喱。只是一个变量声明和初始化。这不是函数curry,response:any=>ITest是一个类型。函数的导出常量:=正确吗-编译器说了什么?你能一步一步地写吗?