Compatibility Issue with `immer` and Complex `Schema.Class` Structures in Effect

I noticed that my more complex schemas using nested Schema.Class properties etc. are not compatible with immer. The issue came up with a simple example such as this:
export class Thing extends Schema.Class<Thing>('shared/Thing')({
  /* ... */
    upgrade: Schema.Struct({ time: Schema.NonNegativeInt, /* ... */ }).pipe(Schema.optional),
}) {
     public applyTimeDiscountModifier(factor1: number, factor2: number) {
        if (!isPresent(this.upgrade)) {
            return this
        }
        return Thing.make({
            ...this,
            upgrade: { ...this.upgrade, time: Math.round(this.upgrade.time * (1 - factor1) * (1 - factor2)) },
        })
    }
}

Originally I wanted to use produce(this, draft => { draft.upgrade.time *= ... }) instead of manually spreading across multiple levels, but immer errors that the object is not supported. Is there a more idiomatic way to achieve this with Effect?
Was this page helpful?