UNPKG

@org-formation/tombok

Version:
30 lines (29 loc) 808 B
declare type Constructor<T = {}> = new (...args: any[]) => T; /** * This decorator generates an all-args constructor for the target class that is * annotated with `@allArgsConstructor`. * * An all-args constructor requires one argument for every field or a object containing * all fields in the class. * * Example: * ```typescript * new Person({ * name: 'Adam Savage', * city: 'San Francisco', * job: 'Mythbusters', * }); * ``` * * Or: * ```typescript * new Person('Adam Savage', 'San Francisco', 'Mythbusters'); * ``` * * @param <T> Type of the base class that must contain a constructor * @param {T} target Base class that we are going to mutate */ export declare function allArgsConstructor<T extends Constructor>(target: T): { new (...args: any[]): {}; } & T; export {};