0.1.8Updated 24 days ago
declare namespace DB {
  interface Entity {
    id?: number
    created_at?: Date
    __parent_class?: string
  }

  namespace Entity {
    type Class = import('../../classes/entity.ts').Entity
    type typeofClass = typeof import('../../classes/entity.ts').Entity

    // deno-lint-ignore no-explicit-any
    type Constructor<T> = typeofClass & (new (...args: any[]) => T);

    type EntitySpecificFields = '__clean' | 'emit' | 'on' | 'off' | 'once' | 'save' | 'EntityClass' | '__parent_class'

    type Clean<T> = Omit<T, EntitySpecificFields>
    type Stripped<T> = Omit<T, EntitySpecificFields | 'id' | 'created_at'>

    type Query<T extends Class> = import('../../modules/db/entity_query.ts').EntityQuery<T>;
  }
}