Skip to content

API ReferenceSetup and configurationType Alias

FieldPaths\<T, Path\>

type FieldPaths<T, Path> = T extends object ? T extends BuiltInObject ? Path : { [K in keyof T]: T[K] extends infer V ? V extends (args: never[]) => unknown ? never : V extends readonly (infer U)[] ? U extends BuiltInObject ? [...Path, K & string, `${number}`] : U extends object ? [(...), (...), (...)] | FieldPaths<(...), (...)> : [(...), (...)] | [(...), (...), (...)] : V extends BuiltInObject ? [...Path, K & string] : V extends object ? FieldPaths<Required<(...)>, [(...), (...)]> : [...(...), (...) & (...)] : never }[keyof T] : never;

Enhanced field path generator that handles complex structures including arrays. This type can generate field paths for validation scenarios where we need to reference specific array indices or nested object properties. Union members are distributed: object members are traversed, while callable members contribute no paths.

Type Parameters

Type ParameterDefault type
T-
Path extends FieldPath[]

Example

interface Config {
locConfig: {
beneficiary: { value: string };
locBeneficiaryAllowList: string[];
};
}
type ValidationPaths = ValidationFieldPaths<Config>;
// Result:
// | ['locConfig', 'beneficiary', 'value']
// | ['locConfig', 'locBeneficiaryAllowList', `${number}`]
// | ['locConfig', 'defaultDestinationAddress']