Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing typescript details on options params of updateMany, updateOne, etc. #14382

Merged
merged 3 commits into from Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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