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
I've seen all the other issues and double checked that "strict": true is in my tsconfig.json
"typescript": "^4.9.5" with up to date create react app setup
This Works as part of a slice and the created action creator becomes ActionCreatorWithPayload
switchAccessory: (state, action: PayloadAction<{ item: Accessory; isSelected: boolean }>) => {
if (action.payload.isSelected) {
if (!state.accessories.some((x) => x.id === action.payload.item.id)) {
// Add accessory if not already there
state.accessories.push(action.payload.item);
} else {
// Add accessory if not already there
state.accessories.push(action.payload.item);
}
}
},
This does not work and the action creator becomes ActionCreatorWithOptionalPayload
switchAccessory: (state, { payload }: PayloadAction<{ item: Accessory; isSelected: boolean }>) => {
if (payload.isSelected) {
if (!state.accessories.some((x) => x.id === payload.item.id)) {
// Add accessory if not already there
state.accessories.push(payload.item);
} else {
// Add accessory if not already there
state.accessories.push(payload.item);
}
}
},
The text was updated successfully, but these errors were encountered:
I've seen all the other issues and double checked that "strict": true is in my tsconfig.json
"typescript": "^4.9.5" with up to date create react app setup
This Works as part of a slice and the created action creator becomes ActionCreatorWithPayload
This does not work and the action creator becomes ActionCreatorWithOptionalPayload
The text was updated successfully, but these errors were encountered: