Redux 无法分配给只读属性';州';对象的'#&书信电报;对象>';

Redux 无法分配给只读属性';州';对象的'#&书信电报;对象>';,redux,redux-toolkit,Redux,Redux Toolkit,我正在使用Redux工具包,我的一个操作有问题。以下是我的切片的相关部分: export const initialCookingSessionState={ recipeInfo:null作为recipeInfo | null, 指令:[]作为指令[], 成分:[]作为成分[], ActiveTimer:[]作为CookingTimer[], currentStepIndex:0作为编号, 步进计时器:[]作为步进计时器[] }; const cookingSessionSlice=creat

我正在使用Redux工具包,我的一个操作有问题。以下是我的切片的相关部分:

export const initialCookingSessionState={
recipeInfo:null作为recipeInfo | null,
指令:[]作为指令[],
成分:[]作为成分[],
ActiveTimer:[]作为CookingTimer[],
currentStepIndex:0作为编号,
步进计时器:[]作为步进计时器[]
};
const cookingSessionSlice=createSlice({
名称:“会话”,
initialState:initialCookingSessionState,
减速器:{
startRecipe(状态,{payload:recipe}:PayloadAction){
const{info,说明书,配料}=配方;
state.recipeInfo=info;
state.components=[…成分];
state.instructions=[…指令]
state.stepTimers=[];
state.instructions.forEach(({timers},stepIndex)=>{
timers.forEach(timer=>
state.stepTimers.push({…timer,stepIndex,state:CookingTimerState.Pending})
)
})
},
incStep(state){state.currentStepIndex++},
decStep(state){state.currentStepIndex-},
startTimer(状态,{payload:timer}:PayloadAction){
timer.state=CookingTimerState.Running
},
}
});
当我分派
startTimer
时,我得到错误:

无法分配给对象“#”的只读属性“状态”

对于Redux工具包的“变异状态更改”,我所缺少的东西肯定有什么是可能的,什么是不可能的。在我看来,我的例子和他们在文档中的例子没有什么不同,但显然我错了。(其他动作效果良好)

如果有帮助的话,以下是我认为非常简单的模型:

导出类配方{
信息:RecipeInfo={
id:“”,
标题:“
};
指令:指令[]=[];
配料:配料[]=[]
}
出口课堂教学{
计时器:CookingTimer[]=[];
构造函数(公共文本:字符串){}
}
出口级配料{
id:string=“”;
state:IngredientState={done:false};
构造函数(公共文本:字符串){}
}
导出类CookingTimer{
建造师(
公共持续时间秒=0,
公共标签=”){}
} 
导出枚举CookingTimerState{
挂起、暂停、运行、完成
}
导出类型步进计时器={
州:CookingTimerState
持续时间秒:数字
标签:字符串
步骤索引:编号
}