You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interfaceState{name: string;age: number;nickName: string;}letreducer=(state: State,action): State=>{switch(action.type){case'ONE':
return{ ...state,x: 'y'};// isn't an error - objects returned by spread don't care about extra paramsdefault:
returnstate;}}
interfaceState{name: string;age: number;nickName: string;}letreducer=(state: State,action): State=>{switch(action.type){case'ONE':
return{x: 'hi',name: '',age: 0,nickName: 'bob'}// this would complain due to 'x' not being on Statedefault:
returnstate;}}
object spread is supported now; check out how its typings work. If it makes sense, adjust the 'strongly typed reducers' article
The text was updated successfully, but these errors were encountered: