Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 509 Bytes

inconsistent-mongoose-type-declaration.md

File metadata and controls

25 lines (18 loc) · 509 Bytes

@refyne/inconsistent-mongoose-type-declaration

Enforce strict required type matching between mongoose and typescript

Rule Details

This rule aimed at detecting inconsistent mongoose field required type declaration in schema as nethier typescript or mongoose complains about it.

Valid

class User {
    @Prop({ required: true })
    userId: string;
}

Invalid

class User {
    @Prop({ required: true })
    userId?: string; // userId is optional but required in mongoose
}