UNPKG

mongo-ts-struct

Version:

Mongoose wrapper for Typescript supports

13 lines (12 loc) 622 B
import * as mongoose from 'mongoose'; export declare type SubType<Base, Condition> = Pick<Base, { [Key in keyof Base]: Base[Key] extends Condition ? Key : never; }[keyof Base]>; declare type ExcludeSubType<Base, NegateCondition> = Pick<Base, { [Key in keyof Base]: Base[Key] extends NegateCondition ? never : Key; }[keyof Base]>; export declare type ExtractFunction<T> = SubType<T, ((_: any) => any)>; export declare type ExtractProperty<T> = ExcludeSubType<T, ((_: any) => any)>; export declare type Ctor<T = any> = new (...args: any[]) => T; export declare type AsDocument<T> = T & mongoose.Document; export {};