ts-flex-query
Version:
Flexible and type-safe data queries
7 lines (6 loc) • 708 B
TypeScript
import { Expression } from '../../core/expression';
import { PipeOperator } from '../../core/pipe-operator';
export type MergeOutType<in out TIn extends Record<PropertyKey, any>, in out TObj extends Record<PropertyKey, any>> = {
[TKey in keyof TIn | keyof TObj]: TKey extends keyof TObj ? TKey extends keyof TIn ? TIn[TKey] extends Record<PropertyKey, any> ? TObj[TKey] extends Record<PropertyKey, any> ? MergeOutType<TIn[TKey], TObj[TKey]> : TObj[TKey] : TObj[TKey] : TObj[TKey] : TKey extends keyof TIn ? TIn[TKey] : never;
};
export declare function merge<TIn extends Record<PropertyKey, any>, TObj extends Record<PropertyKey, any>>(obj: Expression<TObj>): PipeOperator<TIn, MergeOutType<TIn, TObj>>;