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

Written by manueldois | Published 2020/08/21
Tech Story Tags: mongoose | mongodb | typescript | nodejs | model | schema | link | backend

TLDR 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.via the TL;DR App

no story

Published by HackerNoon on 2020/08/21