Mongoose the Typescript way…?

后端 未结 14 554
遥遥无期
遥遥无期 2020-11-28 19:27

Trying to implement a Mongoose model in Typescript. Scouring the Google has revealed only a hybrid approach (combining JS and TS). How would one go about implementing the

14条回答
  •  [愿得一人]
    2020-11-28 20:07

    For anyone looking for a solution for existing Mongoose projects:

    We recently built mongoose-tsgen to address this issue (would love some feedback!). Existing solutions like typegoose required rewriting our entire schemas and introduced various incompatibilities. mongoose-tsgen is a simple CLI tool which generates an index.d.ts file containing Typescript interfaces for all your Mongoose schemas; it requires little to no configuration and integrates very smoothly with any Typescript project.

提交回复
热议问题