Skip to content

Commit 57b48f9

Browse files
committed
types: add toJSONSchema to typescript types
1 parent e893399 commit 57b48f9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ declare module 'mongoose' {
508508
statics: { [F in keyof TStaticMethods]: TStaticMethods[F] } &
509509
{ [name: string]: (this: TModelType, ...args: any[]) => unknown };
510510

511+
toJSONSchema(options?: { useBsonType?: boolean }): Record<string, any>;
512+
511513
/** Creates a virtual type with the given name. */
512514
virtual<T = HydratedDocument<DocType, TVirtuals & TInstanceMethods, TQueryHelpers>>(
513515
name: keyof TVirtuals | string,

types/schematypes.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ declare module 'mongoose' {
300300
/** Declares a full text index. */
301301
text(bool: boolean): this;
302302

303+
toJSONSchema(options?: { useBsonType?: boolean }): Record<string, any>;
304+
303305
/** Defines a custom function for transforming this path when converting a document to JSON. */
304306
transform(fn: (value: any) => any): this;
305307

0 commit comments

Comments
 (0)