UNPKG

cooky-cutter

Version:

Object factories for testing in TypeScript

13 lines (12 loc) 649 B
import { Factory, FactoryConfig } from "./define"; export declare type ArrayFactory<T> = (override?: FactoryConfig<T>) => T[]; export declare type ArrayFactoryPassThrough<T> = (override?: FactoryConfig<T>) => T; export declare const ARRAY_FACTORY_KEY = "arrayFactory"; /** * Define a new array factory function. The return value is a function that can be * invoked as many times as needed to create an array of object of given type. * * @param factory An existing factory object. * @param size Size of target array can be a static value. */ export declare function array<Result>(factory: Factory<Result>, size?: number): ArrayFactory<Result>;