UNPKG

mimicry-js

Version:

TS library for generating fake data for tests

14 lines 1.1 kB
import { FieldsConfiguration, FieldsConfigurationGeneratorFunction } from '../builder/types'; declare const FieldsGeneratorBrand: unique symbol; export declare class FieldsGenerator<FactoryResult, InitialParameters extends any[]> { [FieldsGeneratorBrand]: void; generator: FieldsConfigurationGeneratorFunction<FactoryResult, InitialParameters>; constructor(generator: FieldsConfigurationGeneratorFunction<FactoryResult, InitialParameters>); } type ExtractGeneratorResult<T> = T extends (...args: any[]) => Generator<FieldsConfiguration<infer R>, never | void> ? R : never; type ExtractGeneratorParameters<F> = F extends (...args: void[]) => Generator ? never : F extends (...args: [...infer P]) => Generator ? P : never; type GeneratorFunction = (...args: any[]) => Generator; export declare function generate<Gn extends GeneratorFunction>(generator: Gn): FieldsGenerator<ExtractGeneratorResult<Gn>, ExtractGeneratorParameters<Gn>>; export declare function isFieldsGenerator<G extends FieldsGenerator<any, any>>(value: unknown): value is G; export {}; //# sourceMappingURL=generate.d.ts.map