ts-mongoose icon indicating copy to clipboard operation
ts-mongoose copied to clipboard

Incorrect _id type for ExtractProps

Open fi6 opened this issue 4 years ago • 0 comments

If type of _id is set to be none-ObjectId type, the ExtractProps will still extract _id as ObjectId.

const AccountSchema = createSchema({
    _id: Type.string({ require: true }),
    nickName: Type.string({ require: true }),
    ggSlug: Type.string({ require: true }),
    ggPlayerId: Type.string({ require: true }),
    gamerTag: Type.string({ require: true }),
    prefix: Type.string(),
});

type AccountProps = ExtractProps<typeof AccountSchema>;

type AccountProps = {
    **_id: Types.ObjectId;**
    nickName?: string | undefined;
    ggSlug?: string | undefined;
    ggPlayerId?: string | undefined;
    gamerTag?: string | undefined;
    prefix?: string | undefined;
    __v: number;
}

fi6 avatar Jan 07 '21 19:01 fi6