【发布时间】:2019-11-23 07:06:35
【问题描述】:
我想我有点懂currying function。我对(response: any) => ITest = (response) 中的= 感到困惑
谁能解释一下?
更多代码
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
})
【问题讨论】:
-
这里没有柯里化。只是一个变量声明和初始化。
-
这不是函数柯里化,
(response: any) => ITest是一个类型。=之后是函数 -
我是
export const <name>: <type> = <value> -
“是否正确” - 编译器说了什么?