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: any): State {
  switch (action.type) {
    case
      exportStream.ActionTypes.UPDATE_REPETITION_RATE: {
        return {
          ...state,
          isSaving: true
        };
      }

    case
      exportStream.ActionTypes.UPDATE_REPETITION_RATE_FAIL: {
        return {
          ...state,
          isSaving: false,
          messages: [{
            severity: 'error',
            summary: 'Failed to update repetetion rate for tableId 0x' + (action.payload.tableId.toString().length < 2 ? "0" : "") + Number(action.payload.tableId).toString(16),
            detail: 'Failed to perform action'
          }]
        };
      }

    case
      exportStream.ActionTypes.UPDATE_REPETITION_RATE_SUCCESS: {
        const tempTableTreeUpdateRepettionRate: TableTree = {
          ...state.tableTree,
          privateTables: state.tableTree.privateTables.map(privateTable => {
            if(action.payload.tableId == privateTable.tableId) {
              privateTable.repetitionRateInMilliseconds = action.payload.repetitionRateInMilliseconds;
              return privateTable as PrivateTable;
            }
            return privateTable as PrivateTable;
          }),
        };
        return {
          ...state,
          isSaving: false,
          tableTree: tempTableTreeUpdateRepettionRate,
          messages: [{
            severity: 'success',
            summary: 'Updated repetetion rate for tableId 0x' + (action.payload.tableId.toString().length < 2 ? "0" : "") + Number(action.payload.tableId).toString(16),
            detail: 'Updated repetetion rate for tableId 0x' + (action.payload.tableId.toString().length < 2 ? "0" : "") + Number(action.payload.tableId).toString(16) + ' successfully',
          }]
        };
      }

    case exportStream.ActionTypes.UPDATE_ITEMS_EXPORTSTREAM:
      return Object.assign({}, state, {
        isSaving: true
      });
    case exportStream.ActionTypes.UPDATE_ITEMS_EXPORTSTREAM_SUCCESS:
      let newSelectedItems = state.selectedItems.slice(0);

      // Apply saved changes to current selection state
      action.payload.removedItems.forEach(item => {
        let id = item.tableId + '|' + item.id;
        let index = newSelectedItems.indexOf(id);

        newSelectedItems.splice(index, 1);
      });

      action.payload.addedItems.forEach(item => {
        newSelectedItems.push(item.tableId + '|' + item.id);
      });

      return Object.assign({}, state, {
        tableTreeChanges: emptytableTreeChanges,
        isSaving: false,
        selectedItemsPerExportStream: state.selectedItemsPerExportStream.set(state.selectedExportStream.id, newSelectedItems),
        selectedItems: newSelectedItems
      });
    case exportStream.ActionTypes.UPDATE_ITEMS_EXPORTSTREAM_FAIL:
      const payloadDetailedMessage = action.payload ? `${action.payload}`.replace('Error: Exception while fetching data: ', '') : '';
      return Object.assign({}, state, {
        isSaving: false,
        messages: [{severity: 'error', summary: 'Failed to save', detail: payloadDetailedMessage.length > 0 ? payloadDetailedMessage : 'Failed to perform action'}]
      });

    case exportStream.ActionTypes.EDIT_TABLE:
      return {
        ...state,
        editingTable: action.payload
      };

    case exportStream.ActionTypes.SAVE_TABLE:
      return {
        ...state,
        isSaving: true
      };
    case exportStream.ActionTypes.GET_DEFAULT_REPETITION_RATES:
      return {
        ...state,
        isLoading: true
      };
    case exportStream.ActionTypes.GET_DEFAULT_REPETITION_RATES_FAIL:
      let msg = 'Failed to loading default repetition rate values';
      return {
        ...state,
        isLoading: false,
        defaultRepetitionRates: null,
        messages: [{severity: 'error', summary: msg, detail: 'Failed to perform action'}]
      };

    case exportStream.ActionTypes.GET_DEFAULT_REPETITION_RATES_SUCCESS:
      let tmpExportStreams = action.payload.filter(rate => rate.tags && rate.tags.length > 0).map(rate => ({id: rate.tags[0]}));
      let exportStreams = [];
      tmpExportStreams.forEach(rate => {
        if (exportStreams.find(tmpRate => tmpRate.id === rate.id) === undefined) {
          exportStreams.push(rate);
        }
      });
      return {
        ...state,
        isLoading: false,
        defaultRepetitionRates: action.payload,
        selectedExportStream: (exportStreams.length > 0) ? exportStreams[0] : null,
        exportStreams: exportStreams,
      };

    case
    exportStream.ActionTypes.UPDATE_DEFAULT_REPETITION_RATE
    : {
      return {
        ...state,
        isSaving: true
      };
    }

    case
    exportStream.ActionTypes.UPDATE_DEFAULT_REPETITION_RATE_FAIL
    : {
      return {
        ...state,
        isSaving: false,
        messages: [{
          severity: 'error',
          summary: 'Failed to update default repetetion rate for tableId ' + action.payload.tableId,
          detail: 'Failed to perform action'
        }]
      };
    }

    case exportStream.ActionTypes.UPDATE_DEFAULT_REPETITION_RATE_SUCCESS: {
      let drr: DefaultRepetitionRate = action.payload.defaultRepetitionRate;
      let updatedTables: any[] = action.payload.updatedTables;
      let defaultRepetitionRates = [...state.defaultRepetitionRates];
      let targetIdx = defaultRepetitionRates.findIndex(o => o.id === drr.id);
      if (targetIdx !== -1) {
        defaultRepetitionRates[targetIdx] = drr;
      }
      let tmpTableTree: TableTree = {...state.tableTree};

      if (drr.tableId === TableId.SDT_ID) {
        tmpTableTree.sdtTables = updatedTables;
      }
      let idx = TableId.EIT_ALL_IDS.indexOf(drr.tableId);
      if (idx !== -1) {
        tmpTableTree.eitTablesMap = tmpTableTree.eitTablesMap.set(drr.tableId, updatedTables);
      }
      if (drr.tableId === TableId.NIT_ID) {
        tmpTableTree.nitNetworks = updatedTables;
      }
      if (drr.tableId === TableId.PRIVATE_TABLE_ID) {
        tmpTableTree.privateTables = updatedTables;
      }
      if (drr.tableId === TableId.TDT_ID) {
        tmpTableTree.tdtTables = updatedTables;
      }
      if (drr.tableId === TableId.PID32_ID) {
        tmpTableTree.pid32Tables = updatedTables;
      }
      if (drr.tableId === TableId.PMT_ID) {
        tmpTableTree.pmtTables = updatedTables;
      }
      if (drr.tableId === TableId.PAT_ID) {
        tmpTableTree.patTables = updatedTables;
      }
      if (drr.tableId === TableId.TOT_ID) {
        tmpTableTree.totTables = updatedTables;
      }
      return {
        ...state,
        isSaving: false,
        tableTree: tmpTableTree,
        defaultRepetitionRates: defaultRepetitionRates,
        messages: [{
          severity: 'success',
          summary: 'Updated ' + drr.tags[0] + ' export stream (tableId: ' + drr.tableId + ')',
          detail: 'Updated ' + drr.tags[0] + ' export stream (tableId: ' + drr.tableId + ') successfully',
        }]
      };
    }

    case
    exportStream.ActionTypes.SAVE_TABLE_SUCCESS
    :
      let tmpSdtTables: SdtTable[] = state.tableTree.sdtTables.concat();
      if (action.payload.type === TableTypes.SDT && tmpSdtTables) {
        let idx = tmpSdtTables.findIndex(sdt => sdt.id === action.payload.target.id);
        if (idx !== -1) {
          tmpSdtTables[idx] = action.payload.target
        }
      }
      let tmpNitTables: NitNetwork[] = state.tableTree.nitNetworks.concat();
      if (action.payload.type === TableTypes.NIT && tmpNitTables) {
        let idx = tmpNitTables.findIndex(nit => nit.id === action.payload.target.id);
        if (idx !== -1) {
          tmpNitTables[idx] = action.payload.target
        }
      }
      let tmpPrivateTables: PrivateTable[] = state.tableTree.privateTables.concat();
      if (action.payload.type === TableTypes.PRIVATE_TABLE && tmpPrivateTables) {
        let idx = tmpPrivateTables.findIndex(nit => nit.id === action.payload.target.id);
        if (idx !== -1) {
          tmpPrivateTables[idx] = action.payload.target
        }
      }
      let tmpTdtTables: Tdt[] = state.tableTree.tdtTables.concat();
      if (action.payload.type === TableTypes.TDT && tmpTdtTables) {
        let idx = tmpTdtTables.findIndex(tdt => tdt.id === action.payload.target.id);
        if (idx !== -1) {
          tmpTdtTables[idx] = action.payload.target
        }
      }
      let tmpPid32Tables: Pid32[] = state.tableTree.pid32Tables.concat();
      if (action.payload.type === TableTypes.PID32 && tmpPid32Tables) {
        let idx = tmpPid32Tables.findIndex(pid32 => pid32.id === action.payload.target.id);
        if (idx !== -1) {
          tmpPid32Tables[idx] = action.payload.target
        }
      }

      let tmpPmtTables: Pmt[] = [...state.tableTree.pmtTables];
      if (action.payload.type === TableTypes.PMT && tmpPmtTables) {
        let idx = tmpPmtTables.findIndex(pmt => pmt.id === action.payload.target.id);
        if (idx !== -1) {
          tmpPmtTables[idx] = action.payload.target
        }
      }
      let tmpPatTables: Pat[] = [...state.tableTree.patTables];
      if (action.payload.type === TableTypes.PAT && tmpPatTables) {
        let idx = tmpPatTables.findIndex(pat => pat.id === action.payload.target.id);
        if (idx !== -1) {
          tmpPatTables[idx] = action.payload.target
        }
      }
      let tmpTotTables: Tot[] = [...state.tableTree.totTables];
      if (action.payload.type === TableTypes.TOT && tmpTotTables) {
        let idx = tmpTotTables.findIndex(tot => tot.id === action.payload.target.id);
        if (idx !== -1) {
          tmpTotTables[idx] = action.payload.target
        }
      }

      let tmpEitTablesMap = state.tableTree.eitTablesMap;
      if (action.payload.type === TableTypes.EIT) {
        let currentEit: Eit = action.payload.target;
        let tmpEitTables = tmpEitTablesMap.get(currentEit.tableId) ? [...tmpEitTablesMap.get(currentEit.tableId)] : [];
        let idx = tmpEitTables.findIndex(eit => eit.id === currentEit.id && eit.tableId === currentEit.tableId);
        if (idx !== -1) {
          tmpEitTables[idx] = {
            ...action.payload.target,
            label: tmpEitTables[idx].label
          };
        }
        tmpEitTablesMap = tmpEitTablesMap.set(currentEit.tableId, tmpEitTables);
      }

      let tmpTableTree: TableTree = {
        ...state.tableTree,
        nitNetworks: tmpNitTables,
        sdtTables: tmpSdtTables,
        privateTables: tmpPrivateTables,
        tdtTables: tmpTdtTables,
        pid32Tables: tmpPid32Tables,
        eitTablesMap: tmpEitTablesMap,
        pmtTables: tmpPmtTables,
        patTables: tmpPatTables,
        totTables: tmpTotTables,
      };
      return {
        ...state,
        isSaving: false,
        tableTree: tmpTableTree,
        editingTable: action.payload,
        messages: [{
          severity: 'success',
          summary: 'Updated ' + action.payload.type,
          detail: 'Updated ' + action.payload.type + ' successfully',
        }]
      };

    case
    exportStream.ActionTypes.SAVE_TABLE_FAIL
    :
      return {
        ...state,
        isSaving: false,
        messages: [{
          severity: 'error',
          summary: 'Failed to save ' + action.payload.type,
          detail: 'Failed to perform action'
        }]
      };

    default:
      return state;
  }
}