Skip to content

Commit

Permalink
Merge pull request #14382 from FaizBShah/gh-14378
Browse files Browse the repository at this point in the history
fix: missing typescript details on options params of updateMany, updateOne, etc.
  • Loading branch information
vkarpov15 committed Feb 26, 2024
2 parents 68de586 + a7f1085 commit 28855e1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions types/utility.d.ts
Expand Up @@ -2,6 +2,17 @@ declare module 'mongoose' {
type IfAny<IFTYPE, THENTYPE, ELSETYPE = IFTYPE> = 0 extends (1 & IFTYPE) ? THENTYPE : ELSETYPE;
type IfUnknown<IFTYPE, THENTYPE> = unknown extends IFTYPE ? THENTYPE : IFTYPE;

/**
* @summary Removes keys from a type
* @description It helps to exclude keys from a type
* @param {T} T A generic type to be checked.
* @param {K} K Keys from T that are to be excluded from the generic type
* @returns T with the keys in K excluded
*/
type ExcludeKeys<T, K extends keyof T> = {
[P in keyof T as P extends K ? never : P]: T[P];
};

type Unpacked<T> = T extends (infer U)[] ?
U :
T extends ReadonlyArray<infer U> ? U : T;
Expand Down

0 comments on commit 28855e1

Please sign in to comment.