You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** Sets a default option for this schema type. */
staticset(option: string,value: any): void;
/** Attaches a getter for all instances of this schema type. */
staticget(getter: (value: any)=>any): void;
/** Get/set the function used to cast arbitrary values to this type. */
cast(caster: (v: any)=>any): (v: any)=>any;
If the current behavior is a bug, please provide the steps to reproduce.
so things like the following dont work:
classCustomIntextendsmongoose.SchemaType{constructor(key: string,options: any){super(key,options,'CustomInt');}publiccast(val){// Error: Type 'number' is not assignable to type '(v: any) => any'returnNumber(val);}}
and as an example, SchemaNumber has 3 parameters listed, which are not typed:
Do you want to request a feature or report a bug?
types
What is the current behavior?
it seems like
SchemaType.cast
has value "Function" and wants an "Function" to be returned (plainly speaking)mongoose/index.d.ts
Lines 2472 to 2489 in abf7b02
If the current behavior is a bug, please provide the steps to reproduce.
so things like the following dont work:
and as an example,
SchemaNumber
has 3 parameters listed, which are not typed:mongoose/lib/schema/number.js
Lines 342 to 351 in abf7b02
What is the expected behavior?
the provided example to not error and have correct types
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
5.11.18
am i just maybe using the wrong type to extend from?
The text was updated successfully, but these errors were encountered: