1- import { Object , String , Union } from 'ts-toolbelt ' ;
1+ import { Join , Path , RequireOnlyOne , Split } from './utils ' ;
22import { Paths } from './paths' ;
3- import { NonNullable } from './required' ;
3+ import { NonNullable as NonNullableDeep } from './required' ;
44
55export type FuncCompareOp < C extends Context , F extends FunctionsTable < C , CustomEvaluatorFuncRunOptions > ,
66 K extends keyof F , CustomEvaluatorFuncRunOptions > =
77 Awaited < Parameters < F [ K ] > [ 0 ] > ;
88
99export type StringPaths < O extends object , Ignore > = any extends O ?
10- never : ( any extends Ignore ? never : String . Join < Paths < O , [ ] , Ignore | any [ ] , string > , '.' > ) ;
10+ never : ( any extends Ignore ? never : Join < Paths < O , [ ] , Ignore | any [ ] , string > , '.' > ) ;
1111
1212export type Primitive = string | number | boolean ;
1313
1414export type PropertyPathsOfType < C extends Context , Ignore , V extends Primitive > = {
1515 [ K in StringPaths < C , Ignore > ] :
16- Union . NonNullable < Extract < Object . Path < C , String . Split < K , '.' > > , V > > extends V ? 1 : 0 ;
16+ NonNullable < Extract < Path < C , Split < K , '.' > > , V > > extends V ? 1 : 0 ;
1717} ;
1818
1919export type ExtractPropertyPathsOfType < T extends Record < string , 1 | 0 > > = {
@@ -106,14 +106,14 @@ export type ExtendedCompareOp<C extends Context, Ignore, V extends Primitive> =
106106 NinCompareOp < C , Ignore , V > | NumberCompareOps < C , Ignore , V > | StringCompareOps < C , Ignore , V > |
107107 ExistsCompareOp ;
108108
109- type ExtractPrimitive < T > = Extract < Union . NonNullable < T > , Primitive > ;
109+ type ExtractPrimitive < T > = Extract < NonNullable < T > , Primitive > ;
110110
111111export type PropertyCompareOps < C extends Context , Ignore > = {
112112 [ K in StringPaths < C , Ignore > ] :
113- ExtractPrimitive < Object . Path < C , String . Split < K , '.' > > > extends never ?
113+ ExtractPrimitive < Path < C , Split < K , '.' > > > extends never ?
114114 ExistsCompareOp :
115- ( Extract < Object . Path < C , String . Split < K , '.' > > , Primitive | undefined > |
116- ExtendedCompareOp < C , Ignore , ExtractPrimitive < Object . Path < C , String . Split < K , '.' > > > > )
115+ ( Extract < Path < C , Split < K , '.' > > , Primitive | undefined > |
116+ ExtendedCompareOp < C , Ignore , ExtractPrimitive < Path < C , Split < K , '.' > > > > )
117117} ;
118118
119119export interface AndCompareOp < C extends Context , F extends FunctionsTable < C , CustomEvaluatorFuncRunOptions > ,
@@ -131,7 +131,7 @@ export interface NotCompareOp<C extends Context, F extends FunctionsTable<C, Cus
131131 not : Expression < C , F , Ignore , CustomEvaluatorFuncRunOptions > ;
132132}
133133
134- export type RequireOnlyOne < T extends object > = Object . Either < T , keyof T > ;
134+ export { RequireOnlyOne } ;
135135
136136export type FullExpression < C extends Context , F extends FunctionsTable < C , CustomEvaluatorFuncRunOptions > ,
137137 Ignore , CustomEvaluatorFuncRunOptions > =
@@ -157,7 +157,7 @@ export type FunctionsTable<T, CustomEvaluatorFuncRunOptions> = Record<string, Fu
157157
158158export type Context = Record < string , any > ;
159159
160- export type ValidationContext < C extends Context , Ignore = never > = NonNullable < C , Ignore > ;
160+ export type ValidationContext < C extends Context , Ignore = never > = NonNullableDeep < C , Ignore > ;
161161
162162export interface EvaluationResult < C extends Context , F extends FunctionsTable < C , CustomEvaluatorFuncRunOptions > ,
163163 Ignore , CustomEvaluatorFuncRunOptions > {
0 commit comments