@@ -24,28 +24,32 @@ type BuiltInObjects = Date | Set<unknown> | File;
2424/**
2525 * Lists all paths in an object as string accessors.
2626 */
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 ;
2930
3031/**
3132 * List paths in an object as string accessors, but only with non-objects as accessible properties.
3233 * Similar to the leaves in a node tree, if you look at the object as a tree structure.
3334 */
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 ;
3638
3739/**
3840 * List paths in an object as string accessors, but only with non-objects as accessible properties.
3941 * Also includes the _errors field for objects and arrays.
4042 */
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 ;
4346
4447/**
4548 * List all arrays in an object as string accessors.
4649 */
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 ;
4953
5054type Concat <
5155 Path extends string ,
0 commit comments