File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -1604,3 +1604,30 @@ function gh13215() {
16041604 type SchemaType = InferSchemaType < typeof schema > ;
16051605 expectType < User > ( { } as SchemaType ) ;
16061606}
1607+
1608+ function gh14825 ( ) {
1609+ const schemaDefinition = {
1610+ userName : { type : String , required : true }
1611+ } as const ;
1612+ const schemaOptions = {
1613+ typeKey : 'type' as const ,
1614+ timestamps : {
1615+ createdAt : 'date' ,
1616+ updatedAt : false
1617+ }
1618+ } ;
1619+
1620+ type RawDocType = InferRawDocType <
1621+ typeof schemaDefinition ,
1622+ typeof schemaOptions
1623+ > ;
1624+ type User = {
1625+ userName : string ;
1626+ } ;
1627+
1628+ expectAssignable < User > ( { } as RawDocType ) ;
1629+
1630+ const schema = new Schema ( schemaDefinition , schemaOptions ) ;
1631+ type SchemaType = InferSchemaType < typeof schema > ;
1632+ expectAssignable < User > ( { } as SchemaType ) ;
1633+ }
Original file line number Diff line number Diff line change @@ -87,8 +87,8 @@ declare module 'mongoose' {
8787 'createdAt' | 'updatedAt'
8888 > as TimestampOptions [ K ] extends true
8989 ? K
90- : TimestampOptions [ K ] extends string
91- ? TimestampOptions [ K ]
90+ : TimestampOptions [ K ] extends `${infer TimestampValue } `
91+ ? TimestampValue
9292 : never ] : NativeDate ;
9393 } & T
9494 : T
You can’t perform that action at this time.
0 commit comments