Skip to content

API documentation of Agoric SDK / Exports / @agoric/swingset-liveslots / vatDataTypes / PickFacet

Interface: PickFacet

@agoric/swingset-liveslots.vatDataTypes.PickFacet

Callable

PickFacet

PickFacet<M, F>(maker, facetName): (...args: Parameters<M>) => 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

NameType
Mextends (...args: any[]) => any
Fextends string | number | symbol

Parameters

NameType
makerM
facetNameF

Returns

fn

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

Parameters
NameType
...argsParameters<M>
Returns

ReturnType<M>[F]

Defined in

packages/swingset-liveslots/src/vatDataTypes.d.ts:241