@@ -24,28 +24,32 @@ type BuiltInObjects = Date | Set<unknown> | File;
24
24
/**
25
25
* Lists all paths in an object as string accessors.
26
26
*/
27
- export type FormPath < T extends object , Type = any > = string &
28
- StringPath < T , { filter : 'all' ; objAppend : never ; path : '' ; type : Type } > ;
27
+ export type FormPath < T extends object , Type = any > = string & T extends any
28
+ ? StringPath < T , { filter : 'all' ; objAppend : never ; path : '' ; type : Type } >
29
+ : never ;
29
30
30
31
/**
31
32
* List paths in an object as string accessors, but only with non-objects as accessible properties.
32
33
* Similar to the leaves in a node tree, if you look at the object as a tree structure.
33
34
*/
34
- export type FormPathLeaves < T extends object , Type = any > = string &
35
- StringPath < T , { filter : 'leaves' ; objAppend : never ; path : '' ; type : Type } > ;
35
+ export type FormPathLeaves < T extends object , Type = any > = string & T extends any
36
+ ? StringPath < T , { filter : 'leaves' ; objAppend : never ; path : '' ; type : Type } >
37
+ : never ;
36
38
37
39
/**
38
40
* List paths in an object as string accessors, but only with non-objects as accessible properties.
39
41
* Also includes the _errors field for objects and arrays.
40
42
*/
41
- export type FormPathLeavesWithErrors < T extends object , Type = any > = string &
42
- StringPath < T , { filter : 'leaves' ; objAppend : '_errors' ; path : '' ; type : Type } > ;
43
+ export type FormPathLeavesWithErrors < T extends object , Type = any > = string & T extends any
44
+ ? StringPath < T , { filter : 'leaves' ; objAppend : '_errors' ; path : '' ; type : Type } >
45
+ : never ;
43
46
44
47
/**
45
48
* List all arrays in an object as string accessors.
46
49
*/
47
- export type FormPathArrays < T extends object , Type = any > = string &
48
- StringPath < T , { filter : 'arrays' ; objAppend : never ; path : '' ; type : Type } > ;
50
+ export type FormPathArrays < T extends object , Type = any > = string & T extends any
51
+ ? StringPath < T , { filter : 'arrays' ; objAppend : never ; path : '' ; type : Type } >
52
+ : never ;
49
53
50
54
type Concat <
51
55
Path extends string ,
0 commit comments