I have an interface Contact which extends mongoose.Document interface:
import * as mongoose from 'mongoose';
export interface Contact extends mongoose.Document {
firstname: string;
lastname: string;
address: string;
phone: string;
email: string;
}
And sometimes, I need to use this interface Contact like below:
const contacts: Contact[] = [
{
firstname: 'Marley',
lastname: 'Schultz',
address: '531 Walter Roads',
phone: '1-898-444-3407 x33699'
email: 'Deon_Hammes@gmail.com',
}
];
Since Contact extends mongoose.Document, TypeScript complains that mongoose.Document ' s properties ( increment, model, isDeleted, ... ) are missing.
Is there a way to get a type from Contact but with mongoose.Document ' s properties excluded ?