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: nitNetwork.Actions | descriptor.Actions): State {
  switch (action.type) {
    case nitNetwork.ActionTypes.REQUEST_NIT_TREE:
      return Object.assign({}, state, {
        item: null,
      });

    case nitNetwork.ActionTypes.REQUEST_NIT_NETWORK_DETAIL:
      return Object.assign({}, state, {
        isLoading: true,
      });
    case nitNetwork.ActionTypes.REQUEST_NIT_NETWORK_DETAIL_FAIL:
      return Object.assign({}, state, {
        isLoading: false,
      });

    case nitNetwork.ActionTypes.REFRESH_NIT_NETWORK:
      return {
        ...state,
        isLoading: false,
        item: action.payload
      };

    case nitNetwork.ActionTypes.REQUEST_NIT_NETWORK_DETAIL_SUCCESS:
      return Object.assign({}, state, {
        isLoading: false,
        item: action.payload.detail,
        descriptors: action.payload.descriptors
      });

    case nitNetwork.ActionTypes.SELECT_NEW_NIT_NETWORK:
      return Object.assign({}, state, {
        item: action.payload,
        descriptors: null
      });

    case nitNetwork.ActionTypes.ADD_NIT_NETWORK:
    case nitNetwork.ActionTypes.UPDATE_NIT_NETWORK:
    case nitNetwork.ActionTypes.DELETE_NIT_NETWORK:
      return Object.assign({}, state, {
        isSaving: true
      });

    case nitNetwork.ActionTypes.ADD_NIT_NETWORK_SUCCESS:
      const tempPayload: any = action.payload;
      return Object.assign({}, state, {
        isSaving: false,
        item: tempPayload.nitNetworkDetail.detail,
        descriptors: tempPayload.nitNetworkDetail.descriptors
      });

    case nitNetwork.ActionTypes.ADD_NIT_NETWORK_FAIL:
    case nitNetwork.ActionTypes.UPDATE_NIT_NETWORK_FAIL:
    case nitNetwork.ActionTypes.DELETE_NIT_NETWORK_FAIL:
      return Object.assign({}, state, {
        isSaving: false
      });

    case nitNetwork.ActionTypes.UPDATE_NIT_NETWORK_SUCCESS:
      const tempPayload1: any = action.payload;
      return Object.assign({}, state, {
        isSaving: false,
        item: tempPayload1.nitNetworkDetail.detail,
        descriptors: tempPayload1.nitNetworkDetail.descriptors
      });

    case nitNetwork.ActionTypes.DELETE_NIT_NETWORK_SUCCESS:
      return Object.assign({}, state, {
        isSaving: false,
        item: null
      });

    case descriptor.ActionTypes.ADD_DESCRIPTOR_SUCCESS:
    case descriptor.ActionTypes.UPDATE_DESCRIPTOR_SUCCESS:
      if (action.payload.targetType === 'NitTable' && action.payload.targetId === state.item.id) {
        return Object.assign({}, state, {
          descriptors: state.descriptors.set(action.payload.id, action.payload)
        });
      }

      return state;

    case descriptor.ActionTypes.DELETE_DESCRIPTOR_SUCCESS:
      if (action.payload.targetType === 'NitTable' && action.payload.targetId === state.item.id) {
        return Object.assign({}, state, {
          descriptors: state.descriptors.delete(action.payload.id)
        });
      }
      return state;

    case descriptor.ActionTypes.MOVE_DESCRIPTOR_UP_SUCCESS:
    case descriptor.ActionTypes.MOVE_DESCRIPTOR_DOWN_SUCCESS:
      if (action.payload.targetType === 'NitTable' && action.payload.targetId === state.item.id) {
        let descriptorsPayload: Descriptor[] = action['descriptors'];
        let newDescriptors = Map(descriptorsPayload.map(d => [d.id, d]));
        return {
          ...state,
          descriptors: newDescriptors as Map<string, Descriptor>,
          isSaving: false,
        };
      }
      return state;

    default:
      return state;
  }
}