UNPKG

mongoose-tsgen

Version:

A Typescript interface generator for Mongoose that works out of the box.

41 lines (40 loc) 1.2 kB
/** * Contains information parsed from ts-morph about various types for each model */ export declare type TsReaderModelTypes = { [modelName: string]: { /** mongoose method function types */ methods: { [funcName: string]: string; }; /** mongoose static function types */ statics: { [funcName: string]: string; }; /** mongoose query function types */ query: { [funcName: string]: string; }; /** mongoose virtual types */ virtuals: { [virtualName: string]: string; }; schemaVariableName?: string; modelVariableName?: string; filePath: string; /** comments found in the mongoose schema */ comments: { path: string; comment: string; }[]; }; }; declare type UndefinedKeys<T> = { [K in keyof T]: undefined extends T[K] ? K : never; }[keyof T]; declare type MarkOptional<T, K extends keyof T = UndefinedKeys<T>> = Omit<T, K> & Partial<Pick<T, K>>; declare type Resolve<T> = { [K in keyof T]: T[K]; }; export declare type Normalize<T> = Resolve<MarkOptional<T>>; export {};