Skip to content

Commit ad7824f

Browse files
committed
test cleanup
1 parent da37597 commit ad7824f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/types/inferrawdoctype.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,39 @@ import { InferRawDocType, Schema, AutoInferredSchema } from 'mongoose';
22
import { expectType, expectError } from 'tsd';
33

44
function gh14839() {
5+
const schemaDefinition = {
6+
email: {
7+
type: String,
8+
trim: true,
9+
required: true,
10+
unique: true,
11+
lowercase: true
12+
},
13+
password: {
14+
type: String,
15+
required: true
16+
},
17+
dateOfBirth: {
18+
type: Date,
19+
required: true
20+
},
21+
subdoc: new AutoInferredSchema({
22+
name: { type: String, required: true }
23+
}),
24+
docArr: [new AutoInferredSchema({ test: { type: String, required: true } })]
25+
};
26+
27+
type UserType = InferRawDocType<typeof schemaDefinition>;
28+
expectType<{
29+
email: string,
30+
password: string,
31+
dateOfBirth: Date,
32+
subdoc?: { name: string } | null,
33+
docArr: { test: string }[]
34+
}>({} as UserType);
35+
}
36+
37+
function gh14954() {
538
const schemaDefinition = {
639
email: {
740
type: String,

0 commit comments

Comments
 (0)