@adyen/kyc-components
Version:
This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.
20 lines (19 loc) • 1.27 kB
TypeScript
interface RecursiveKeyOfOptions {
readonly includePartialPaths?: boolean;
}
export type RecursiveKeyOf<TObj extends object, Options extends RecursiveKeyOfOptions = {
includePartialPaths: false;
}> = {
[TKey in keyof TObj & (string | number)]: RecursiveKeyOfHandleValue<TObj[TKey], `${TKey}`, Options>;
}[keyof TObj & (string | number)];
type RecursiveKeyOfInner<TObj extends object, Options extends RecursiveKeyOfOptions> = {
[TKey in keyof TObj & (string | number)]: RecursiveKeyOfHandleValue<TObj[TKey], `.${TKey}`, Options>;
}[keyof TObj & (string | number)];
type RecursiveKeyOfHandleValue<TValue, Text extends string, Options extends RecursiveKeyOfOptions> = TValue extends any[] ? Text : TValue extends object ? `${Text}${RecursiveKeyOfInner<TValue, Options>}` | (Options['includePartialPaths'] extends true ? Text : never) : Text;
/**
* @returns A list of only the primitive keys of an object.
* Includes those nested within other objects, e.g. `'name.firstName'`.
* @param includeUndefined - whether to include properties which are defined but have a value of `undefined`.
*/
export declare function getNestedPropertyKeys<T extends object>(obj: T, includeUndefined?: boolean, includeFalsy?: boolean): Array<RecursiveKeyOf<T>>;
export {};