Skip to content

Commit

Permalink
types: add toJSONSchema to typescript types
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jan 20, 2025
1 parent e893399 commit 57b48f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@ declare module 'mongoose' {
statics: { [F in keyof TStaticMethods]: TStaticMethods[F] } &
{ [name: string]: (this: TModelType, ...args: any[]) => unknown };

toJSONSchema(options?: { useBsonType?: boolean }): Record<string, any>;

/** Creates a virtual type with the given name. */
virtual<T = HydratedDocument<DocType, TVirtuals & TInstanceMethods, TQueryHelpers>>(
name: keyof TVirtuals | string,
Expand Down
2 changes: 2 additions & 0 deletions types/schematypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ declare module 'mongoose' {
/** Declares a full text index. */
text(bool: boolean): this;

toJSONSchema(options?: { useBsonType?: boolean }): Record<string, any>;

/** Defines a custom function for transforming this path when converting a document to JSON. */
transform(fn: (value: any) => any): this;

Expand Down

0 comments on commit 57b48f9

Please sign in to comment.