How To Link Mongoose And Typescript for a Single Source of Truthby@manueldois
9,846 reads
9,846 reads

How To Link Mongoose And Typescript for a Single Source of Truth

by Manuel Maldonado7mAugust 21st, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

How To Link Mongoose And Typescript for a Single Source of Truth: How To link Mongoose and Typesccript for a single Source of truth. The typical way to declare a user model looks something like this:import { model, Schema } from'mongoose' interface IUser { username : string, email : String,. password : String;. Users have no knowledge of the fields it keeps, as it is of the generic mongoose document. Adding typesafety for Populate and Select including statics and instance methods Splitting the user model into backend and frontend representations.

Company Mentioned

Mention Thumbnail
featured image - How To Link Mongoose And Typescript for a Single Source of Truth
Manuel Maldonado HackerNoon profile picture
Manuel Maldonado

Manuel Maldonado

@manueldois

L O A D I N G
. . . comments & more!

About Author

Manuel Maldonado HackerNoon profile picture
Manuel Maldonado@manueldois

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite