Closed richard-jfc closed 5 months ago
It would actually be great if it could do even better and reference the original enum (if it is exported).
Output:
export type test = {
status: Status;
_id: mongoose.Types.ObjectId;
};
Nice catch, I didn't know mongoose supported passing enums directly. Will take a look this weekend. Handling the parsing of an enum type should be no problem so I'll start there to get you support ASAP, but referencing the original enum will likely be a bit more involved.
Fix live in v9.3.0 🚀 I dont think im going to be able to get to your second use case as its much more complicated to integrate, but let me know if its critical and I can try to plan it late in the summer
Mongoose supports setting enums from a typescript enum (https://github.com/Automattic/mongoose/issues/9546), but mongoose-tsgen generates a
string
type.Actual Output:
Expected Output:
Work Around: