Skip to content

Commit

Permalink
fix(index.d.ts): add instance, options, schema properties to Sc…
Browse files Browse the repository at this point in the history
…hemaType class

Fix #10609
  • Loading branch information
vkarpov15 committed Aug 25, 2021
1 parent 8d8f4db commit f9bf537
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion index.d.ts
Expand Up @@ -2923,7 +2923,7 @@ declare module 'mongoose' {

class SchemaType {
/** SchemaType constructor */
constructor(path: string, options?: any, instance?: string);
constructor(path: string, options?: AnyObject, instance?: string);

/** Get/set the function used to cast arbitrary values to this type. */
static cast(caster?: Function | boolean): Function;
Expand Down Expand Up @@ -2957,6 +2957,12 @@ declare module 'mongoose' {
/** Declares the index options for this schematype. */
index(options: any): this;

/** String representation of what type this is, like 'ObjectID' or 'Number' */
instance: string;

/** The options this SchemaType was instantiated with */
options: AnyObject;

/**
* Set the model that this path refers to. This is the option that [populate](https://mongoosejs.com/docs/populate.html)
* looks at to determine the foreign collection it should query.
Expand All @@ -2969,6 +2975,9 @@ declare module 'mongoose' {
*/
required(required: boolean, message?: string): this;

/** The schema this SchemaType instance is part of */
schema: Schema<any>;

/** Sets default select() behavior for this path. */
select(val: boolean): this;

Expand Down

0 comments on commit f9bf537

Please sign in to comment.