interface PickFacet (<M, F>(maker, facetName) => ((...args) => ReturnType<M>[F]))
  • 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)
    • F extends string | number | symbol

    Parameters

    • maker: M
    • facetName: F

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

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

        • Rest ...args: Parameters<M>

        Returns ReturnType<M>[F]