• When making a multi-facet kind, it's common to pick one facet to expose. E.g.,

    const makeFoo = (a, b, c, d) => makeFooBase(a, b, c, d).self;
    

    This helper reduces the duplication:

    const makeFoo = pickFacet(makeFooBase, 'self');
    

    Type Parameters

    • M extends ((...args: any[]) => any)
    • F extends string | number | symbol

    Parameters

    • maker: M
    • facetName: F

    Returns ((...args: Parameters<M>) => ReturnType<M>[F])

      • (...args): ReturnType<M>[F]
      • Parameters

        • Rest...args: Parameters<M>

        Returns ReturnType<M>[F]