fix(database): typings

This commit is contained in:
chenos 2022-02-17 16:16:05 +08:00
parent 86e0f071e4
commit 9c422b7879
6 changed files with 11 additions and 28 deletions

View File

@ -1,14 +1,11 @@
import merge from 'deepmerge';
import { EventEmitter } from 'events';
import { default as lodash, default as _ } from 'lodash';
import { Model, ModelCtor, ModelOptions } from 'sequelize';
import { SyncOptions } from 'sequelize/types/lib/sequelize';
import { Model, ModelCtor, ModelOptions, SyncOptions } from 'sequelize';
import { Database } from './database';
import { Field, FieldOptions } from './fields';
import { Repository } from './repository';
const { hooks } = require('sequelize/lib/hooks');
export type RepositoryType = typeof Repository;
export type CollectionSortable = string | boolean | { name?: string; scopeKey?: string };

View File

@ -1,10 +1,6 @@
import { omit } from 'lodash';
import { Sequelize, ModelCtor, Model, DataTypes, Utils } from 'sequelize';
import { BelongsToOptions as SequelizeBelongsToOptions, Utils } from 'sequelize';
import { BaseRelationFieldOptions, RelationField } from './relation-field';
import { HasInverseField } from './has-inverse-field';
import { BaseColumnFieldOptions, Field } from './field';
import { HasManyField } from './has-many-field';
import { BelongsToOptions as SequelizeBelongsToOptions } from 'sequelize/types/lib/associations/belongs-to';
export class BelongsToField extends RelationField {
static type = 'belongsTo';

View File

@ -1,9 +1,7 @@
import { omit } from 'lodash';
import { Sequelize, ModelCtor, Model, DataTypes, Utils } from 'sequelize';
import { BelongsToManyOptions as SequelizeBelongsToManyOptions } from 'sequelize';
import { Collection } from '../collection';
import { BaseRelationFieldOptions, RelationField } from './relation-field';
import { BaseColumnFieldOptions } from './field';
import { BelongsToManyOptions as SequelizeBelongsToManyOptions } from 'sequelize/types/lib/associations/belongs-to-many';
export class BelongsToManyField extends RelationField {
get through() {

View File

@ -1,17 +1,13 @@
import { omit } from 'lodash';
import {
Sequelize,
ModelCtor,
Model,
DataType,
AssociationScope,
DataType,
ForeignKeyOptions,
HasManyOptions,
Utils,
HasManyOptions as SequelizeHasManyOptions,
Utils
} from 'sequelize';
import { BaseRelationFieldOptions, RelationField } from './relation-field';
import { BaseColumnFieldOptions } from './field';
import { HasManyOptions as SequelizeHasManyOptions } from 'sequelize/types/lib/associations/has-many';
export interface HasManyFieldOptions extends HasManyOptions {
/**

View File

@ -1,17 +1,13 @@
import { omit } from 'lodash';
import {
Sequelize,
ModelCtor,
Model,
DataType,
AssociationScope,
DataType,
ForeignKeyOptions,
HasOneOptions,
Utils,
HasOneOptions as SequelizeHasOneOptions,
Utils
} from 'sequelize';
import { BaseRelationFieldOptions, RelationField } from './relation-field';
import { BaseColumnFieldOptions } from './field';
import { HasOneOptions as SequelizeHasOneOptions } from 'sequelize/types/lib/associations/has-one';
export interface HasOneFieldOptions extends HasOneOptions {
/**

View File

@ -1,7 +1,7 @@
import Database from './database';
import lodash from 'lodash';
import { Model } from 'sequelize';
import { SequelizeHooks } from 'sequelize/types/lib/hooks';
import type { SequelizeHooks } from 'sequelize/types/lib/hooks';
import Database from './database';
const { hooks } = require('sequelize/lib/hooks');