@@ -473,7 +473,7 @@ export function autoTypedSchema() {
473
473
decimal1 : Schema . Types . Decimal128 ,
474
474
decimal2 : 'Decimal128' ,
475
475
decimal3 : 'decimal128'
476
- } ) ;
476
+ } as const ) ;
477
477
478
478
type InferredTestSchemaType = InferSchemaType < typeof TestSchema > ;
479
479
@@ -508,12 +508,12 @@ export function autoTypedSchema() {
508
508
} ) ,
509
509
favoritDrink : {
510
510
type : String ,
511
- enum : [ 'Coffee' , 'Tea' ]
511
+ enum : [ 'Coffee' , 'Tea' ] as const
512
512
} ,
513
513
favoritColorMode : {
514
514
type : String ,
515
515
enum : {
516
- values : [ 'dark' , 'light' ] ,
516
+ values : [ 'dark' , 'light' ] as const ,
517
517
message : '{VALUE} is not supported'
518
518
} ,
519
519
required : true
@@ -597,8 +597,8 @@ function encryptionType() {
597
597
expectError ( new Schema < unknown > ( { name : { type : String , encrypt : { keyId } } } , { encryptionType : 'newFakeEncryptionType' } ) ) ;
598
598
expectError ( new Schema < unknown > ( { name : { type : String , encrypt : { keyId } } } , { encryptionType : 1 } ) ) ;
599
599
600
- expectType < Schema > ( new Schema < unknown > ( { name : { type : String , encrypt : { keyId } } } , { encryptionType : 'queryableEncryption' } ) ) ;
601
- expectType < Schema > ( new Schema < unknown > ( { name : { type : String , encrypt : { keyId } } } , { encryptionType : 'csfle' } ) ) ;
600
+ const schema1 = new Schema < unknown > ( { name : { type : String , encrypt : { keyId } } } , { encryptionType : 'queryableEncryption' } ) ;
601
+ const schema2 = new Schema < unknown > ( { name : { type : String , encrypt : { keyId } } } , { encryptionType : 'csfle' } ) ;
602
602
}
603
603
604
604
function gh11828 ( ) {
@@ -707,7 +707,7 @@ function gh12030() {
707
707
} > ( { } as B ) ;
708
708
709
709
expectType < {
710
- users : Types . DocumentArray < {
710
+ users : Array < {
711
711
username ?: string | null
712
712
} > ;
713
713
} > ( { } as InferSchemaType < typeof Schema1 > ) ;
@@ -728,7 +728,7 @@ function gh12030() {
728
728
} ) ;
729
729
730
730
expectType < {
731
- users : Types . DocumentArray < {
731
+ users : Array < {
732
732
credit : number ;
733
733
username ?: string | null ;
734
734
} > ;
@@ -780,7 +780,7 @@ function pluginOptions() {
780
780
}
781
781
782
782
const schema = new Schema ( { } ) ;
783
- expectType < Schema < any , any > > ( schema . plugin ( pluginFunction ) ) ; // test that chaining would be possible
783
+ schema . plugin ( pluginFunction ) ; // test that chaining would be possible
784
784
785
785
// could not add strict tests that the parameters are inferred correctly, because i dont know how this would be done in tsd
786
786
@@ -1028,7 +1028,7 @@ function gh12869() {
1028
1028
const dbExample = new Schema (
1029
1029
{
1030
1030
active : { type : String , enum : [ 'foo' , 'bar' ] , required : true }
1031
- }
1031
+ } as const
1032
1032
) ;
1033
1033
1034
1034
type Example = InferSchemaType < typeof dbExample > ;
@@ -1056,7 +1056,7 @@ function gh12882() {
1056
1056
} ] ,
1057
1057
required : true
1058
1058
}
1059
- } ) ;
1059
+ } as const ) ;
1060
1060
type tArrNum = InferSchemaType < typeof arrNum > ;
1061
1061
expectType < {
1062
1062
fooArray : number [ ]
@@ -1079,7 +1079,7 @@ function gh12882() {
1079
1079
} ) ;
1080
1080
type tArrType = InferSchemaType < typeof arrType > ;
1081
1081
expectType < {
1082
- fooArray : Types . DocumentArray < {
1082
+ fooArray : Array < {
1083
1083
type : string ;
1084
1084
foo : number ;
1085
1085
} >
@@ -1130,7 +1130,7 @@ function gh12882() {
1130
1130
} ) ;
1131
1131
type rTArrType = InferSchemaType < typeof rArrType > ;
1132
1132
expectType < {
1133
- fooArray : Types . DocumentArray < {
1133
+ fooArray : Array < {
1134
1134
type : string ;
1135
1135
foo : number ;
1136
1136
} >
0 commit comments