import { Schema , Document , Model , model , Connection } from 'mongoose' ; import { Extract } from './types' ; export function typedModel < T extends Schema , S extends { [ name ] : Function ; } > ( name , schema ? , collection ? , skipInit ? , statics ? , connection ? ) { if ( schema && statics ) schema . statics = statics ; if ( connection ) return connection . model ( name , schema , collection ) as any ; return model ( name , schema , collection , skipInit ) as any ; }