Metzploreur/node_modules/mongoose/types/virtuals.d.ts
clement callaert 244d45ceb8 Version 2
2023-11-01 17:33:25 +01:00

14 lines
960 B
TypeScript

declare module 'mongoose' {
type VirtualPathFunctions<DocType = {}, PathValueType = unknown, TInstanceMethods = {}> = {
get?: TVirtualPathFN<DocType, PathValueType, TInstanceMethods, PathValueType>;
set?: TVirtualPathFN<DocType, PathValueType, TInstanceMethods, void>;
options?: VirtualTypeOptions<HydratedDocument<DocType, TInstanceMethods>, DocType>;
};
type TVirtualPathFN<DocType = {}, PathType = unknown, TInstanceMethods = {}, TReturn = unknown> =
<T = HydratedDocument<DocType, TInstanceMethods>>(this: Document<any, any, DocType> & DocType, value: PathType, virtual: VirtualType<T>, doc: Document<any, any, DocType> & DocType) => TReturn;
type SchemaOptionsVirtualsPropertyType<DocType = any, VirtualPaths = Record<any, unknown>, TInstanceMethods = {}> = {
[K in keyof VirtualPaths]: VirtualPathFunctions<IsItRecordAndNotAny<DocType> extends true ? DocType : any, VirtualPaths[K], TInstanceMethods>
};
}