ts-flex-query
Version:
Flexible and type-safe data queries
9 lines (8 loc) • 617 B
TypeScript
import { PipeOperator } from '../../core/pipe-operator';
import { ObjectValueSelector, ObjectValueSelectorType } from '../../helpers/object-value-selector';
import { TsFlexQueryTypeMarker } from '../../types/ts-flex-query-type';
export type RecordSpec<in TIn = any> = Record<string, ObjectValueSelector<TIn>>;
export type RecordOutType<TIn, TRecord extends RecordSpec> = TsFlexQueryTypeMarker<'record'> & {
[TKey in keyof TRecord]: ObjectValueSelectorType<TIn, TRecord[TKey]>;
};
export declare function record<TIn, TRecord extends RecordSpec<TIn>>(spec: TRecord): PipeOperator<TIn, RecordOutType<TIn, TRecord>>;