francescov1 / mongoose-tsgen

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

Add Model's static and member function signature #5

Closed shivshankar3578 closed 3 years ago

shivshankar3578 commented 4 years ago

As per example https://github.com/Bounced-Inc/mongoose-tsgen#example piece of generated definition isMetadataString: Function; should be valid signature of isMetadataString method isMetadataString: (this: IUser) => Boolean

francescov1 commented 4 years ago

Hey, I completely agree! The way the tool works, it reads in Mongoose schemas into memory (same way your app would) and infers types from the schema data. The only type we can get from that is Function (since TS has already been transpiled at this point).

ts-morph seems like a solid option for reading the Typescript info. I can take a look at this but it likely won't be for a couple weeks, you're welcome to contribute in the meantime!