报错:TS2322: Type any is not assignable to type never
const ErrorSlice = createSlice({
name: 'error',
initialState: [],
reducers: {
Publish: (state, action) => {
console.log(action)
state = [...state, action.payload]
},
Consume: () => [],
}
})
调用端
await axios
.post(`host`, Params)
.then((data: Response) => data.data.Response)
.catch((e) => {
ErrorState.dispatch(Publish(e.response.data.Error))
})
我不太明白 never
什么意思我给的不是字符么很明显的
需要使用插件自己的数据类型
PayloadAction