import { Property , VariantsOfUnion } from './variant' ; /**
 * An object that has the same keys as a variant but has arbitrary values for the data.
 * a.k.a. a lookup table.
 */ export type Lookup < T , U = any > = { [ P in keyof T ] : U ; } ; param obj param handler param typeKey export function lookup < T extends Property < K , string > , L extends Lookup < VariantsOfUnion < T , K > > , K extends string = 'type' > ( obj , handler , typeKey ? ) { const typeString = obj [ typeKey ?? 'type' as K ] ; return handler [ typeString ] ; } param obj param handler param typeKey export function partialLookup < T extends Property < K , string > , L extends Lookup < VariantsOfUnion < T , K > > , K extends string = 'type' > ( obj , handler , typeKey ? ) { return lookup ( obj , handler as L , typeKey ) ; }