Function type for updating state with optimistic values.
The updated state after applying the optimistic value.
The type of the current state.
The type of the optimistic value.