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: actions.Actions): State {
  switch (action.type) {
    case actions.ActionTypes.DELETE_LOGICAL_SERVICE_SUCCESS:
      delete action.payload.originalNetworkId;
      return Object.assign({}, state, {
        selectedService: null,
        logicalServices: state.logicalServices.delete(action.payload.id),
        messages: [{
          severity: 'success',
          summary: 'service deleted',
          detail: `Service ${action.payload.alias} deleted`
        }]
      });
    case actions.ActionTypes.DELETE_LOGICAL_SERVICE_FAIL:
      return Object.assign({}, state, {
        messages: [{
          severity: 'error',
          summary: 'Failed to delete service',
          detail: action.payload
        }]
      });
    case actions.ActionTypes.GET_RELATED_DATA:
      return Object.assign({}, state, {
        isLoading: true,
        relatedData: {}
      });

    case actions.ActionTypes.GET_LOGICAL_SERVICE_LIST:
      return Object.assign({}, state, {
        isLoading: true,
        selectedService: null,
        logicalServices: null,
        messages: null
      });
    case actions.ActionTypes.GET_LOGICAL_SERVICE_LIST_SUCCESS:
      return Object.assign({}, state, {
        isLoading: false,
        logicalServices: action.payload
      });
    case actions.ActionTypes.GET_LOGICAL_SERVICE_LIST_FAIL:
      return Object.assign({}, state, {
        isLoading: false,
        selectedService: null,
        messages: [{
          severity: 'error',
          summary: 'Failed to retrieve services',
          detail: action.payload
        }]
      });
    case actions.ActionTypes.GET_RELATED_DATA_FAIL:
      return Object.assign({}, state, {
        isLoading: false,
        relatedData: {}
      });
    case actions.ActionTypes.GET_RELATED_DATA_SUCCESS:
      return Object.assign({}, state, {
        isLoading: false,
        relatedData: action.payload
      });

    case actions.ActionTypes.ADD_LOGICAL_SERVICE:
      return Object.assign({}, state, {
        ...state,
        isSaving: true,
      });

    case actions.ActionTypes.SET_LOGICAL_SERVICE_TRANSPORT_STREAMS_FAIL:
    case actions.ActionTypes.SET_LOGICAL_SERVICE_LCN_OVERRIDES_FAIL:
      return Object.assign({}, state, {
        messages: [{
          severity: 'error',
          summary: 'Failed to update service',
          detail: action.payload
        }]
      });

    case actions.ActionTypes.SET_LOGICAL_SERVICE_LCN_OVERRIDES_SUCCESS:
      let logicalServiceWithNewLcnOverrides = Object.assign({}, state.logicalServices.get(action.payload.detail.id), {
        lcnOverridesCount: action.payload.detail.lcnOverridesCount
      });

      return Object.assign({}, state, {
        logicalServices: state.logicalServices.set(action.payload.detail.id, logicalServiceWithNewLcnOverrides),
        messages: [{
          severity: 'success',
          summary: 'Info Message',
          detail: `Service updated`
        }]
      });

    case actions.ActionTypes.SET_LOGICAL_SERVICE_TRANSPORT_STREAMS_SUCCESS:
      let logicalServiceWithNewTsIds = Object.assign({}, state.logicalServices.get(action.payload.id), {
        sdtTableCount: action.payload.sdtTableCount
      });

      return Object.assign({}, state, {
        logicalServices: state.logicalServices.set(action.payload.id, logicalServiceWithNewTsIds),
        messages: [{
          severity: 'success',
          summary: 'Info Message',
          detail: `Service updated`,
        }]
      });

    case actions.ActionTypes.CREATE_SCHEDULE_SERVICE_SUCCESS:
    case actions.ActionTypes.UPDATE_SCHEDULE_SERVICE_SUCCESS:
      let relatedData = Object.assign({}, state.relatedData, {
        providers: state.relatedData.providers.set(action.payload.providerId, action.payload.providerId)
      });
      return Object.assign({}, state, {
        relatedData: relatedData,
        messages: [{
          severity: 'success',
          summary: 'Info Message',
          detail: `Provider updated`
        }]
      });

    case actions.ActionTypes.CREATE_SCHEDULE_SERVICE_FAIL:
    case actions.ActionTypes.UPDATE_SCHEDULE_SERVICE_FAIL:
      return Object.assign({}, state, {
        messages: [{
          severity: 'error',
          summary: 'Failed to update service',
          detail: action.payload
        }]
      });

    case actions.ActionTypes.LOGICAL_SERVICE_DOES_NOT_EXIST:
      return Object.assign({}, state, {
        messages: [{
          severity: 'error',
          summary: 'Failed to display the page',
          detail: 'Logical service doesn\'t exist'
        }],
      });

    default:
      return state;
  }
}