UNPKG

@elgervb/mock-data

Version:

Mock data made easy, while maintaining type safety

25 lines (24 loc) 579 B
export declare type Closure<R> = () => R; /** * Blueprint for a model to mock. Use the key-names of the type and value must be a string (eg. the type to generate) * * Example: * ``` * export interface A { * a: number; * b: string; * c: Date; * } * const bp: Blueprint<A> = { * a: 'number', // ok * b: 'guid', // ok * d: 'string' // => error: no such property on interface A * } * ``` */ export declare type Blueprint<T> = { [P in keyof T]?: Closure<T[P]>; }; export declare type BlueprintConstantProperties<T> = { [P in keyof T]?: T[P]; };