import { createSchema , Type , typedModel } from '../../src' ; import { Types } from 'mongoose' ; import { NotAny } from './5.mixed' ; const str = { a1 : Type . string ( { required : true } ) } ; const num = { a1 : Type . number ( { required : true } ) } ; const bool = { a1 : Type . boolean ( { required : true } ) } ; const date = { a1 : Type . date ( { required : true } ) } ; const objId = { a1 : Type . objectId ( { required : true } ) } ; const mix = { a1 : Type . mixed ( { required : true } ) } ; const obj = { a1 : Type . object ( { required : true } ) . of ( { b1 : Type . string ( { required : true } ) , } ) , } ; const arr = { a1 : Type . array ( { required : true } ) . of ( Type . string ( ) ) } ; const subSchema = createSchema ( { a1 : Type . string ( ) } ) ; const schema = createSchema ( { a : Type . object ( ) . of ( str ) , b : Type . object ( { required : true } ) . of ( str ) , c : Type . object ( ) . of ( num ) , d : Type . object ( { required : true } ) . of ( num ) , e : Type . object ( ) . of ( bool ) , f : Type . object ( { required : true } ) . of ( bool ) , g : Type . object ( ) . of ( date ) , h : Type . object ( { required : true } ) . of ( date ) , i : Type . object ( ) . of ( objId ) , j : Type . object ( { required : true } ) . of ( objId ) , k : Type . object ( ) . of ( mix ) , l : Type . object ( { required : true } ) . of ( mix ) , m : Type . object ( ) . of ( obj ) , n : Type . object ( { required : true } ) . of ( obj ) , o : Type . object ( ) . of ( arr ) , p : Type . object ( { required : true } ) . of ( arr ) , q : Type . object ( ) . of ( subSchema ) , r : Type . object ( { required : true } ) . of ( subSchema ) , } ) ; typedModel ( '' , schema ) . findOne ( ) . then ( val => { if ( val ) { val . a && onlyA1String ( val . a ) ; onlyA1String ( val . b ) ; val . c && onlyA1Number ( val . c ) ; onlyA1Number ( val . d ) ; val . e && onlyA1Boolean ( val . e ) ; onlyA1Boolean ( val . f ) ; val . g && onlyA1Date ( val . g ) ; onlyA1Date ( val . h ) ; val . i && onlyA1ObjectId ( val . i ) ; onlyA1ObjectId ( val . j ) ; val . k && onlyA1Mix ( val . k ) ; onlyA1Mix ( val . l ) ; val . m && onlyA1Obj ( val . m ) ; onlyA1Obj ( val . n ) ; val . o && onlyA1Arr ( val . o ) ; onlyA1Arr ( val . p ) ; } } ) ; function onlyA1String ( _ ) { } function onlyA1Number ( _ ) { } function onlyA1Boolean ( _ ) { } function onlyA1Date ( _ ) { } function onlyA1ObjectId ( _ ) { } function onlyA1Mix < T extends any > ( _ ) { } function onlyA1Obj ( _ ) { } function onlyA1Arr ( _ ) { }