How can I use a TS type in a mongoose schema? I have the following:
...
type Associated = {
associatedId : string
imei : string
vehicleTypeId: string
}
interface IGroup extends Document {
...
associated: Associated
...
}
const Group = new Schema(
{
...
associated: {
type: Associated
},
...
},
{
collection: 'group'
}
)
...
But I getting an error: 'Associated' only refers to a type, but is being used as a value here.