Skip to content

Commit

Permalink
test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Oct 14, 2024
1 parent da37597 commit ad7824f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/types/inferrawdoctype.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@ import { InferRawDocType, Schema, AutoInferredSchema } from 'mongoose';
import { expectType, expectError } from 'tsd';

function gh14839() {
const schemaDefinition = {
email: {
type: String,
trim: true,
required: true,
unique: true,
lowercase: true
},
password: {
type: String,
required: true
},
dateOfBirth: {
type: Date,
required: true
},
subdoc: new AutoInferredSchema({
name: { type: String, required: true }
}),
docArr: [new AutoInferredSchema({ test: { type: String, required: true } })]
};

type UserType = InferRawDocType<typeof schemaDefinition>;
expectType<{
email: string,
password: string,
dateOfBirth: Date,
subdoc?: { name: string } | null,
docArr: { test: string }[]
}>({} as UserType);
}

function gh14954() {
const schemaDefinition = {
email: {
type: String,
Expand Down

0 comments on commit ad7824f

Please sign in to comment.