@oazmi/kitchensink - v0.9.13
    Preparing search index...

    Type Alias MirrorComposition<T, P>

    MirrorComposition: T & { [composition_key in P]: T }

    a utility type that mirrors a type T, in addition to enclosing the object T under the composition property key P.

    this utility type is used by the functions mirrorObjectThroughComposition and subclassThroughComposition.

    Type Parameters

    • T
    • P extends PropertyKey
    const obj_a = {
    hello: "world",
    goodbye: "earth",
    answer() { return 42 },
    }

    const obj_b = {
    _super: obj_a, // composing/enclosing `obj_a`
    ...obj_a, // mirroring the methods and properties of `obj_a`
    }

    obj_b satisfies MirrorComposition<typeof obj_a, "_super">