korimsoft-tyfun
Version:
Korimsoft's TyFun - A library of TypeScript functions, types, helpers, and utilities
10 lines • 472 B
TypeScript
type WithMethodName<K extends string> = K extends `${infer T}${string}` ? T extends Lowercase<T> ? `with${Capitalize<K>}` : `with_${K}` : never;
type BuilderMethods<T> = {
[K in keyof T as WithMethodName<string & K>]: (value: T[K]) => Builder<T>;
};
export type Builder<T> = BuilderMethods<T> & {
build: () => T;
};
export declare function aBuilder<T extends Record<string, any>>(template?: Partial<T>): Builder<T>;
export {};
//# sourceMappingURL=builder.d.ts.map