Interface SubclassThroughCompositionConfig<CLASS_KEY, INSTANCE_KEY>

configuration options for the function subclassThroughComposition.

this configuration effectively specifies the MirrorObjectThroughCompositionConfig configuration for the class and its instances.

by default, the following subconfiguration is used for both class and instance: { baseKey: "_super", mirrorPrototype: true, propertyKeys: [] }

  • if your class's instances contain properties that are not defined in the prototype (i.e. dynamically assigned properties), then you will need to define them in instance.propertyKeys. in a similar way, if your class has dynamically assigned static properties, then you'll need to define them in class.propertyKeys for them to get mirrored.

  • the baseKey option lets you pick the key that is used for accessing the composed base object from the derived subclass. assuming that class.baseKey = "_super" and instance.baseKey = "_super", then the generated "subclass" will be able to access the enclosed class in the following way:

    • inside a static class method: this._super satisfies typeof cls
    • inside an instance method: this._super satisfies InstanceType<typeof cls>
interface SubclassThroughCompositionConfig<
    CLASS_KEY extends PropertyKey = string,
    INSTANCE_KEY extends PropertyKey = string,
> {
    class?: Partial<
        Omit<MirrorObjectThroughCompositionConfig<CLASS_KEY>, "target">,
    >;
    instance?: Partial<
        Omit<MirrorObjectThroughCompositionConfig<INSTANCE_KEY>, "target">,
    >;
}

Type Parameters

  • CLASS_KEY extends PropertyKey = string
  • INSTANCE_KEY extends PropertyKey = string

Properties

Properties

class?: Partial<Omit<MirrorObjectThroughCompositionConfig<CLASS_KEY>, "target">>
instance?: Partial<
    Omit<MirrorObjectThroughCompositionConfig<INSTANCE_KEY>, "target">,
>