francescov1 / mongoose-tsgen

A plug-n-play Typescript generator for Mongoose.
102 stars 24 forks source link

(Hot)fix for overflow when using mongoose.Types.ObjectId #15

Closed HoldYourWaffle closed 3 years ago

HoldYourWaffle commented 3 years ago

It looks like #14 is caused by mongoose.Schema.Types.ObjectIdmongoose.Types.ObjectId. As far as I know (which isn't much) both are valid, and I think I saw the latter being used in a test somewhere.

I (hot)fixed this by simply checking for both versions at each place in the parser where I could find a reference. I have no idea if this is a complete/correct/neat/desirable solution, but I wanted to take a shot at contributing anyway :)

In case you don't want to merge this, 3e621f5 contains a fix for the tests on windows, so you might want to cherry-pick it 🍒

francescov1 commented 3 years ago

Hey @HoldYourWaffle, I appreciate all the suggestions/issues you've recently added & this fix! I'm a little swamped right now but will try to review all this stuff over the weekend and get back to you on suggestions + merge this in!

francescov1 commented 3 years ago

This fix was published on v5.0.1, thanks!