'cannot add property x, object is not extensible

I am trying to write a function that adds an object to an formik FieldArray. I am not using preventExtensions func and I also tried making a copy of the object from a different solution I found but nothing has worked in resolving this error. Does anyone know how to add this object and avoid this error?

const handleDropDownValueCheck = (e: any) => {
    const propertyFileIndex: number = e.target.value;
    const propertyInformation: object = {
      address: PropertyFiles[propertyFileIndex]?.address as string,
      property_file_id: PropertyFiles[propertyFileIndex]
        ?.property_file_id as string,
      property_file_name: PropertyFiles[propertyFileIndex]
        ?.property_file_name as string,
      property_id: propertyListItem?.id,
    };

    selectedProperties?.find((propertyMapping, i) => {
      if (propertyMapping.property_id === propertyListItem?.id) {
        selectedProperties[i] = propertyInformation;
      }
    });

    const propertyInformationCopy = Object.assign([], propertyInformation);

    selectedProperties?.push(propertyInformationCopy);

    arrayHelpers.push(selectedProperties);
  };


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source