declare module 'mongoose' { type Unpacked = T extends (infer U)[] ? U : T extends ReadonlyArray ? U : T; type UnpackedIntersection = T extends null ? null : T extends (infer A)[] ? (Omit & U)[] : keyof U extends never ? T : Omit & U; type MergeType = Omit & B; /** * @summary Converts Unions to one record "object". * @description It makes intellisense dialog box easier to read as a single object instead of showing that in multiple object unions. * @param {T} T The type to be converted. */ type FlatRecord = { [K in keyof T]: T[K] }; /** * @summary Checks if a type is "Record" or "any". * @description It Helps to check if user has provided schema type "EnforcedDocType" * @param {T} T A generic type to be checked. * @returns true if {@link T} is Record OR false if {@link T} is of any type. */ type IsItRecordAndNotAny = IfEquals ? true : false>; /** * @summary Checks if two types are identical. * @param {T} T The first type to be compared with {@link U}. * @param {U} U The seconde type to be compared with {@link T}. * @param {Y} Y A type to be returned if {@link T} & {@link U} are identical. * @param {N} N A type to be returned if {@link T} & {@link U} are not identical. */ type IfEquals = (() => G extends T ? 1 : 0) extends (() => G extends U ? 1 : 0) ? Y : N; }