import type { Asyncify, } from 'type-fest'; export type AsyncifyArray< Input extends any[], > = { [Key in keyof Input]: ( Input[Key] extends (...arguments_: any) => any ? Asyncify : Input[Key] ) }; export type AsyncifyParameters< FunctionType extends (...arguments_: any[]) => any, FunctionTypeArguments = AsyncifyArray>, > = FunctionTypeArguments extends any[] ? FunctionTypeArguments : []; export interface PathOperationSet< FunctionType extends (...arguments_: any[]) => any, FunctionTypeArguments extends any[] = AsyncifyParameters, AsyncFunctionType = (...arguments_: FunctionTypeArguments) => Promise>, > { sync: FunctionType, async: AsyncFunctionType } export interface PathResolver extends PathOperationSet< (path: string) => T > {} export type PathResolverFunction = PathResolver['sync']; export type PathResolverFunctionAsync = PathResolver['async']; export interface PathPredicate extends PathOperationSet< (path: string) => boolean > {} export type PathPredicateFunction = PathPredicate['sync']; export type PathPredicateFunctionAsync = PathPredicate['async']; export interface PathWalkerProcessFunction { (path: string): T } export interface PathWalkerOverload { ( path: string, predicate: PathPredicateFunction, ): string; ( path: string, predicate: PathPredicateFunction, process?: PathWalkerProcessFunction, ): T } export interface PathWalker extends PathOperationSet> {} export type PathWalkerFunction = PathWalker['sync']; export type PathWalkerFunctionAsync = PathWalker['async'];