UNPKG

ts-mockgen

Version:

Generate mock objects from TypeScript types using the TypeScript AST (ts-morph).

12 lines (11 loc) 589 B
/** * Generates a mock object based on a TypeScript type name defined in the current project. * * @param typeName - The name of the TypeScript type to mock (interface, type alias, or exported type). * @param overrides - Optional object specifying values to override in the generated mock. * * @returns A mock object matching the specified type with default values filled in and overrides applied. * * @throws Error if the specified type is not found in the project’s source files. */ export declare function generateMock(typeName: string, overrides?: Record<string, any>): any;