Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Type '{ type: typeof mongoose.Types.Decimal128; get: (l: mongoose.Types.Decimal128) => string; }' is not assignable to type 'SchemaDefinitionProperty<Decimal128> | undefined'.
Types of property 'type' are incompatible.
Type 'typeof Decimal128' is not assignable to type 'typeof SchemaType | Schema<any, any, any> | Decimal128 | { _bsontype?: SchemaDefinitionProperty<"Decimal128"> | undefined; readonly bytes?: SchemaDefinitionProperty<...> | undefined; toString?: SchemaDefinitionProperty<...> | undefined; toJSON?: SchemaDefinitionProperty<...> | undefined; inspect?: SchemaDefinitionPr...'.
Type 'typeof Decimal128' is missing the following properties from type 'typeof SchemaType': cast, checkRequired, set, getts(2322)
If the current behavior is a bug, please provide the steps to reproduce.
import * as mongoose from 'mongoose';
interface User {
name: string
amount: mongoose.Types.Decimal128;
}
const UserSchema = new mongoose.Schema<User>(
{
name: { type: String },
amount: {
type: mongoose.Types.Decimal128,
get: (l: mongoose.Types.Decimal128) => l && l.toString(),
},
}
);
What is the expected behavior?
should not throw any error
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node - 14.17.0, Mongoose 6.0.10, Mongodb - 4.2, TS - 4.4.2
Do you want to request a feature or report a bug? Bug
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior? should not throw any error
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version. Node - 14.17.0, Mongoose 6.0.10, Mongodb - 4.2, TS - 4.4.2