const helloReducer = (state: Immut = initialState, action: { type: string, payload: any }) => {
switch (action.type) {
case SAY_HELLO:
return state.set('message', action.payload)
default:
return state
}
}
(state: Immut = initialState, action: { type: string, payload: any }) 这个参数是什么写法?解构也不长这个样子啊?
跪求答案?
这是typescript或者flow的语法
写成js的话就是这样
冒号后面指定的类型是用于编译期检查参数类型的