declare module 'factory-girl' { export const factory: typeof FactoryGirl; export class Generator { constructor(factoryGirl: FactoryGirl); generate: any; getAttribute: (name: string, model: T, key: string) => any; } export class ChanceGenerator extends Generator { generate: (chanceMethod: string, ...options: any[]) => any; } export class Factory {} export class FactoryGirl { static FactoryGirl: new () => FactoryGirl; constructor(options?: object); chance: ChanceGenerator['generate']; // TODO: allow for a function inititalizer define( name: string, Model: any, initializer?: | { [P in keyof T]: any } | ((options: D) => { [P in keyof T]: any }), buildOptions?: D ): Factory; create( name: string, attrs?: Partial, buildOptions?: D ): Promise; createMany( name: string, num: number, attrs?: Partial, buildOptions?: D ): Promise; build( name: string, attrs?: Partial, buildOptions?: D ): Promise; assoc( name: string, key?: keyof T, attrs?: Partial | {}, buildOptions?: object ): any; assocMany( name: string, count: number, key?: keyof T | null, attrs?: Partial | {}, buildOptions?: object ): T[]; assocAttrs( name: string, key?: keyof T | null, attrs?: Partial | {}, buildOptions?: object ): T; assocAttrsMany( name: string, count: number, key?: keyof T | null, attrs?: Partial | {}, buildOptions?: object ): T[]; setAdapter(adapter: Adapter, name?: string): Adapter; cleanUp(): Promise; } export class DefaultAdapter { build(Model: C, props: T): C; save(model: any, Model: any): Promise; destroy(model: any, Model: any): Promise; get: (model: T, attr: I, Model: C) => I; set: (props: I, model: T, Model: C) => T; } export class MongooseAdapter extends DefaultAdapter {} }