The following code is a ngrx 4 reducer could you make it compatible for ngrx 16 so it works with createReducer()

export function reducer(state = initialState, action: schedule.Actions | service.Actions): State {
  switch (action.type) {
    case schedule.ActionTypes.REQUEST_SERVICES:
      return {
        ...state,
        isLoadingServices: true,
      };

    case schedule.ActionTypes.REQUEST_SERVICES_FAIL:
      return {
        ...state,
        isLoadingServices: false,
      };

    // cannot pass services & providers directly
    case schedule.ActionTypes.REQUEST_SERVICES_SUCCESS:
      return {
        ...state,
        isLoadingServices: false,
        services: action.payload.services,
        providers: action.payload.providers,
      };

    case schedule.ActionTypes.DELETE_SERVICE:
      return {
        ...state,
        isLoadingServices: true
      };

    case schedule.ActionTypes.DELETE_SERVICE_FAIL:
      return {
        ...state,
        isLoadingServices: false,
        messages: [{
          severity: 'error',
          summary: 'Deleting service failed',
          detail: action.payload,
        }]
      };
    case schedule.ActionTypes.DELETE_SERVICE_SUCCESS:
      const deletedService: ScheduleService = action.payload;
      const newServices: ScheduleService[] = state.services.filter(service => service !== deletedService);

      return {
        ...state,
        isLoadingServices: false,
        services: newServices,
        messages: [{
          severity: 'success',
          summary: 'Service ' + deletedService.id + ' deleted',
          detail: 'Service ' + deletedService.id + ' successfully deleted',
        }]
      };

    case schedule.ActionTypes.REQUEST_EVENTS:
      return {
        ...state,
        isLoadingEvents: true,
      };

    case schedule.ActionTypes.REQUEST_EVENTS_FAIL:
      return Object.assign({}, state, {
        isLoadingEvents: false,
      });

    case schedule.ActionTypes.REQUEST_EVENTS_SUCCESS:
      const events: ScheduleEvent[] = action.payload;
      const map = Map<number, ScheduleEvent[]>().asMutable();
      events.forEach(ev => {
        if (map.get(ev.serviceId) === undefined) {
          map.set(ev.serviceId, []);
        }
        map.get(ev.serviceId).push(ev);
      });
      return {
        ...state,
        isLoadingEvents: false,
        events: events,
        eventsMap: map.asImmutable(),
      };

    case schedule.ActionTypes.REQUEST_PRESENT_FOLLOWING_EVENTS:
      return {
        ...state,
        isLoadingPresentFollowingEvents: true,
      };

    case schedule.ActionTypes.REQUEST_PRESENT_FOLLOWING_EVENTS_FAIL:
      return {
        ...state,
        isLoadingPresentFollowingEvents: false,
      };

    case schedule.ActionTypes.REQUEST_PRESENT_FOLLOWING_EVENTS_SUCCESS:
      return {
        ...state,
        isLoadingPresentFollowingEvents: false,
        presentFollowingEvents: action.payload
      };


    case schedule.ActionTypes.UPDATE_PRESENT_FOLLOWING_EVENT:
      return {
        ...state,
        isLoadingPresentFollowingEvents: true,
      };

    case schedule.ActionTypes.UPDATE_PRESENT_FOLLOWING_EVENT_FAIL:
      return {
        ...state,
        isLoadingPresentFollowingEvents: false,
        messages: [{
          severity: 'error',
          summary: 'Failed to update present following event',
          detail: action.payload
        }]
      };

    case schedule.ActionTypes.UPDATE_PRESENT_FOLLOWING_EVENT_SUCCESS:
      const tmpPFEvents = state.presentFollowingEvents.map(ev => ev.serviceId === action.payload.serviceId ? action.payload : ev);
      return {
        ...state,
        presentFollowingEvents: tmpPFEvents,
        isLoadingPresentFollowingEvents: false,
        messages: [{
          severity: 'success',
          summary: 'Updated present following event',
          detail: 'Successfully set event ' + action.payload.presentEvent.eventId + ' for service ' + action.payload.serviceId + ' as present event',
        }]
      };
    case schedule.ActionTypes.UPDATE_SERVICE_FILTER:
    case schedule.ActionTypes.UPDATE_PROVIDER_FILTERS:
    case schedule.ActionTypes.UPDATE_TRIGGER_MODE_FILTERS:
      return Object.assign({}, state, {
        updatingFilters: true
      });

    case schedule.ActionTypes.UPDATE_PROVIDER_FILTERS_SUCCESS:
      return {
        ...state,
        providerFilters: action.payload,
        updatingFilters: false,
      };

    case schedule.ActionTypes.UPDATE_PROVIDER_FILTERS_FAIL:
      return {
        ...state,
        providerFilters: [],
        updatingFilters: false,
      };

    case schedule.ActionTypes.UPDATE_TRIGGER_MODE_FILTERS_SUCCESS:
      return {
        ...state,
        triggerModeFilters: action.payload,
        updatingFilters: false,
      };

    case schedule.ActionTypes.UPDATE_TRIGGER_MODE_FILTERS_FAIL:
      return {
        ...state,
        triggerModeFilters: [],
        updatingFilters: false,
      };

    case schedule.ActionTypes.UPDATE_SERVICE_FILTER_SUCCESS:
      return {
        ...state,
        serviceFilter: action.payload,
        updatingFilters: false,
      };

    case schedule.ActionTypes.UPDATE_SERVICE_FILTER_FAIL:
      return {
        ...state,
        serviceFilter: [],
        updatingFilters: false,
      };

    case schedule.ActionTypes.RESET_FILTERS:
      return {
        ...state,
        serviceFilter: [],
        providerFilters: [],
        triggerModeFilters: [],
        updatingFilters: false,
      };

    case service.ActionTypes.UPDATE_SERVICE_SUCCESS: {
      let updatedService: ScheduleService = action.payload;
      let services = state.services.concat();
      let idx = services.findIndex((currs) => currs.id === updatedService.id);
      let old = services[idx];
      if (idx !== -1) {
        services.splice(idx, 1, {...updatedService, alias: old.alias, serviceName: old.serviceName});
      }
      return {
        ...state,
        services,
        updatingFilters: false,
      };
    }
    case schedule.ActionTypes.OVERRIDE_TO_INTERNAL_TRIGGER:
    case schedule.ActionTypes.RESET_TRIGGER_OVERRIDE:
      return {
        ...state,
        isLoadingServices: true,
      };
    case schedule.ActionTypes.OVERRIDE_TO_INTERNAL_TRIGGER_FAIL:
    case schedule.ActionTypes.RESET_TRIGGER_OVERRIDE_FAIL:
      return {
        ...state,
        isLoadingServices: false,
        messages: [{
          severity: 'error',
          summary: 'Failed to update services',
          detail: action.payload,
        }]
      };

    case schedule.ActionTypes.OVERRIDE_TO_INTERNAL_TRIGGER_SUCCESS:
    case schedule.ActionTypes.RESET_TRIGGER_OVERRIDE_SUCCESS: {
      let updatedServices: ScheduleService[] = action.payload;
      let services = [...state.services];
      updatedServices.forEach(s => {
        let idx = services.findIndex((currs) => currs.id === s.id);
        if (idx !== -1) {
          services.splice(idx, 1, {...s, alias: services[idx].alias, serviceName: services[idx].serviceName});
        }
      });
      const strSuccess = (action.payload as ScheduleService[]).map(s => s.id).join(', ')
      const successMessage = {
        severity: 'success',
        summary: 'Successfully updated service(s) ' + strSuccess,
        detail: 'Successfully updated service(s) ' + strSuccess,
      }
      let messages = [successMessage];
      const notEligible: ScheduleService[] = action['notEligible'];
      if (notEligible.length > 0) {
        const strFailed = notEligible.map(s => s.id).join(', ');
        const failedMessage = {
          severity: 'error',
          summary: 'Service(s) ' + strFailed + ' not updated   ',
          detail: 'Service(s) ' + strFailed + ' not eligible for override',
        };
        messages.push(failedMessage);
      }
      return {
        ...state,
        isLoadingServices: false,
        services: services,
        messages: messages,
      };
    }
    default:
      return state;
  }
}