UNPKG

975 BTypeScriptView Raw
1type BaseNamePath = string | number | boolean | (string | number | boolean)[];
2/**
3 * Store: The store type from `FormInstance<Store>`
4 * ParentNamePath: Auto generate by nest logic. Do not fill manually.
5 */
6export type DeepNamePath<Store = any, ParentNamePath extends any[] = []> = ParentNamePath['length'] extends 5 ? never : true extends (Store extends BaseNamePath ? true : false) ? ParentNamePath['length'] extends 0 ? Store | BaseNamePath : Store extends any[] ? [...ParentNamePath, number] : never : Store extends any[] ? // Connect path. e.g. { a: { b: string }[] }
7[
8 ...ParentNamePath,
9 number
10] | DeepNamePath<Store[number], [...ParentNamePath, number]> : keyof Store extends never ? Store : {
11 [FieldKey in keyof Store]: Store[FieldKey] extends Function ? never : (ParentNamePath['length'] extends 0 ? FieldKey : never) | [...ParentNamePath, FieldKey] | DeepNamePath<Required<Store>[FieldKey], [...ParentNamePath, FieldKey]>;
12}[keyof Store];
13export {};