diff --git a/src/associations/belongs-to-many/belongs-to-many-association.ts b/src/associations/belongs-to-many/belongs-to-many-association.ts index 8924c367..9045092b 100644 --- a/src/associations/belongs-to-many/belongs-to-many-association.ts +++ b/src/associations/belongs-to-many/belongs-to-many-association.ts @@ -1,4 +1,4 @@ -import {BelongsToManyOptions as OriginBelongsToManyOptions, Model, ThroughOptions} from "sequelize"; +import {BelongsToManyOptions as OriginBelongsToManyOptions, ThroughOptions} from "sequelize"; import {BaseAssociation} from '../shared/base-association'; import {BelongsToManyOptions} from './belongs-to-many-options'; @@ -8,11 +8,12 @@ import {ModelClassGetter} from "../../model/shared/model-class-getter"; import {Association} from "../shared/association"; import {Sequelize} from "../../sequelize/sequelize/sequelize"; import {UnionAssociationOptions} from "../shared/union-association-options"; +import {ModelType} from "../../model/model/model"; -export class BelongsToManyAssociation extends BaseAssociation { +export class BelongsToManyAssociation extends BaseAssociation { - constructor(associatedClassGetter: ModelClassGetter, - protected options: BelongsToManyOptions) { + constructor(associatedClassGetter: ModelClassGetter, + protected options: BelongsToManyOptions) { super(associatedClassGetter, options); } @@ -20,7 +21,7 @@ export class BelongsToManyAssociation extends BaseAssociation { return Association.BelongsToMany; } - getSequelizeOptions(model: typeof Model, + getSequelizeOptions(model: ModelType, sequelize: Sequelize): UnionAssociationOptions { const options: OriginBelongsToManyOptions = {...this.options as any}; const associatedClass = this.getAssociatedClass(); diff --git a/src/associations/belongs-to-many/belongs-to-many-options.ts b/src/associations/belongs-to-many/belongs-to-many-options.ts index 248e4930..895b1300 100644 --- a/src/associations/belongs-to-many/belongs-to-many-options.ts +++ b/src/associations/belongs-to-many/belongs-to-many-options.ts @@ -3,8 +3,8 @@ import {ModelClassGetter} from "../../model/shared/model-class-getter"; import {ThroughOptions} from "../through/through-options"; -export type BelongsToManyOptions = { +export type BelongsToManyOptions = { [K in keyof OriginBelongsToManyOptions]: K extends 'through' - ? ModelClassGetter | string | ThroughOptions + ? ModelClassGetter | string | ThroughOptions : OriginBelongsToManyOptions[K] }; diff --git a/src/associations/belongs-to-many/belongs-to-many.ts b/src/associations/belongs-to-many/belongs-to-many.ts index 0323cf33..2d80135a 100644 --- a/src/associations/belongs-to-many/belongs-to-many.ts +++ b/src/associations/belongs-to-many/belongs-to-many.ts @@ -3,19 +3,19 @@ import {BelongsToManyAssociation} from './belongs-to-many-association'; import {ModelClassGetter} from "../../model/shared/model-class-getter"; import {addAssociation} from "../shared/association-service"; -export function BelongsToMany(associatedClassGetter: ModelClassGetter, - through: ModelClassGetter | string, +export function BelongsToMany(associatedClassGetter: ModelClassGetter, + through: ModelClassGetter | string, foreignKey?: string, otherKey?: string): Function; -export function BelongsToMany(associatedClassGetter: ModelClassGetter, - options: BelongsToManyOptions): Function; -export function BelongsToMany(associatedClassGetter: ModelClassGetter, - throughOrOptions: ModelClassGetter | string | BelongsToManyOptions, +export function BelongsToMany(associatedClassGetter: ModelClassGetter, + options: BelongsToManyOptions): Function; +export function BelongsToMany(associatedClassGetter: ModelClassGetter, + throughOrOptions: ModelClassGetter | string | BelongsToManyOptions, foreignKey?: string, otherKey?: string): Function { return (target: any, propertyName: string) => { - let options: Partial = {foreignKey, otherKey}; + let options: Partial> = {foreignKey, otherKey}; if (typeof throughOrOptions === 'string' || typeof throughOrOptions === 'function') { @@ -28,7 +28,7 @@ export function BelongsToMany(associatedClassGetter: ModelClassGetter, addAssociation(target, new BelongsToManyAssociation( associatedClassGetter, - options as BelongsToManyOptions, + options as BelongsToManyOptions, ) ); }; diff --git a/src/associations/belongs-to/belongs-to-association.ts b/src/associations/belongs-to/belongs-to-association.ts index 73212441..b26035e1 100644 --- a/src/associations/belongs-to/belongs-to-association.ts +++ b/src/associations/belongs-to/belongs-to-association.ts @@ -4,12 +4,12 @@ import {BaseAssociation} from '../shared/base-association'; import {getForeignKeyOptions} from "../foreign-key/foreign-key-service"; import {ModelClassGetter} from "../../model/shared/model-class-getter"; import {Association} from "../shared/association"; -import {Model} from "../../model/model/model"; +import {ModelType} from "../../model/model/model"; import {UnionAssociationOptions} from "../shared/union-association-options"; -export class BelongsToAssociation extends BaseAssociation { +export class BelongsToAssociation extends BaseAssociation { - constructor(associatedClassGetter: ModelClassGetter, + constructor(associatedClassGetter: ModelClassGetter, protected options: BelongsToOptions) { super(associatedClassGetter, options); } @@ -18,7 +18,7 @@ export class BelongsToAssociation extends BaseAssociation { return Association.BelongsTo; } - getSequelizeOptions(model: typeof Model): UnionAssociationOptions { + getSequelizeOptions(model: ModelType): UnionAssociationOptions { const associatedClass = this.getAssociatedClass(); const foreignKey = getForeignKeyOptions(associatedClass, model, this.options.foreignKey); diff --git a/src/associations/belongs-to/belongs-to.ts b/src/associations/belongs-to/belongs-to.ts index a09a391a..5ac50971 100644 --- a/src/associations/belongs-to/belongs-to.ts +++ b/src/associations/belongs-to/belongs-to.ts @@ -4,11 +4,11 @@ import {BelongsToAssociation} from './belongs-to-association'; import {ModelClassGetter} from "../../model/shared/model-class-getter"; import {addAssociation, getPreparedAssociationOptions} from "../shared/association-service"; -export function BelongsTo(associatedClassGetter: ModelClassGetter, foreignKey?: string): Function; +export function BelongsTo(associatedClassGetter: ModelClassGetter, foreignKey?: string): Function; -export function BelongsTo(associatedClassGetter: ModelClassGetter, options?: BelongsToOptions): Function; +export function BelongsTo(associatedClassGetter: ModelClassGetter, options?: BelongsToOptions): Function; -export function BelongsTo(associatedClassGetter: ModelClassGetter, optionsOrForeignKey?: string | BelongsToOptions): Function { +export function BelongsTo(associatedClassGetter: ModelClassGetter, optionsOrForeignKey?: string | BelongsToOptions): Function { return (target: any, propertyName: string) => { const options: BelongsToOptions = getPreparedAssociationOptions(optionsOrForeignKey); diff --git a/src/associations/foreign-key/foreign-key-meta.ts b/src/associations/foreign-key/foreign-key-meta.ts index 768ce922..5ed86fd2 100644 --- a/src/associations/foreign-key/foreign-key-meta.ts +++ b/src/associations/foreign-key/foreign-key-meta.ts @@ -1,7 +1,7 @@ import {ModelClassGetter} from "../../model/shared/model-class-getter"; -export interface ForeignKeyMeta { +export interface ForeignKeyMeta { - relatedClassGetter: ModelClassGetter; + relatedClassGetter: ModelClassGetter; foreignKey: string; } diff --git a/src/associations/foreign-key/foreign-key-service.ts b/src/associations/foreign-key/foreign-key-service.ts index aeccf881..6de931e5 100644 --- a/src/associations/foreign-key/foreign-key-service.ts +++ b/src/associations/foreign-key/foreign-key-service.ts @@ -1,12 +1,13 @@ -import {ForeignKeyOptions, Model} from "sequelize"; +import {ForeignKeyOptions} from "sequelize"; import {ForeignKeyMeta} from './foreign-key-meta'; import {ModelClassGetter} from "../../model/shared/model-class-getter"; +import {ModelType} from "../../model/model/model"; const FOREIGN_KEYS_KEY = 'sequelize:foreignKeys'; -export function getForeignKeyOptions(relatedClass: typeof Model, - classWithForeignKey?: typeof Model, +export function getForeignKeyOptions(relatedClass: ModelType, + classWithForeignKey?: ModelType, foreignKey?: string | ForeignKeyOptions): ForeignKeyOptions { let foreignKeyOptions: ForeignKeyOptions = {}; @@ -36,8 +37,8 @@ export function getForeignKeyOptions(relatedClass: typeof Model, /** * Adds foreign key meta data for specified class */ -export function addForeignKey(target: any, - relatedClassGetter: ModelClassGetter, +export function addForeignKey(target: any, + relatedClassGetter: ModelClassGetter, foreignKey: string): void { let foreignKeys = getForeignKeys(target); if (!foreignKeys) { @@ -53,7 +54,7 @@ export function addForeignKey(target: any, /** * Returns foreign key meta data from specified class */ -export function getForeignKeys(target: any): ForeignKeyMeta[] | undefined { +export function getForeignKeys(target: any): ForeignKeyMeta[] | undefined { const foreignKeys = Reflect.getMetadata(FOREIGN_KEYS_KEY, target); if (foreignKeys) { return [...foreignKeys]; diff --git a/src/associations/foreign-key/foreign-key.ts b/src/associations/foreign-key/foreign-key.ts index f7f00057..789040bc 100644 --- a/src/associations/foreign-key/foreign-key.ts +++ b/src/associations/foreign-key/foreign-key.ts @@ -1,7 +1,7 @@ import {addForeignKey} from "./foreign-key-service"; import {ModelClassGetter} from "../../model/shared/model-class-getter"; -export function ForeignKey(relatedClassGetter: ModelClassGetter): Function { +export function ForeignKey(relatedClassGetter: ModelClassGetter): Function { return (target: any, propertyName: string) => { addForeignKey(target, relatedClassGetter, propertyName); }; diff --git a/src/associations/has/has-association.ts b/src/associations/has/has-association.ts index 4a3379c3..b8145e76 100644 --- a/src/associations/has/has-association.ts +++ b/src/associations/has/has-association.ts @@ -1,14 +1,15 @@ -import {HasManyOptions, HasOneOptions, Model} from 'sequelize'; +import {HasManyOptions, HasOneOptions} from 'sequelize'; import {BaseAssociation} from '../shared/base-association'; import {getForeignKeyOptions} from "../foreign-key/foreign-key-service"; import {ModelClassGetter} from "../../model/shared/model-class-getter"; import {Association} from "../shared/association"; import {UnionAssociationOptions} from "../shared/union-association-options"; +import {ModelType} from '../../model/model/model'; -export class HasAssociation extends BaseAssociation { +export class HasAssociation extends BaseAssociation { - constructor(associatedClassGetter: ModelClassGetter, + constructor(associatedClassGetter: ModelClassGetter, protected options: HasManyOptions | HasOneOptions, private association: Association) { super(associatedClassGetter, options); @@ -18,7 +19,7 @@ export class HasAssociation extends BaseAssociation { return this.association; } - getSequelizeOptions(model: typeof Model): UnionAssociationOptions { + getSequelizeOptions(model: ModelType): UnionAssociationOptions { const options = {...this.options}; const associatedClass = this.getAssociatedClass(); diff --git a/src/associations/has/has-many.ts b/src/associations/has/has-many.ts index 53f6d1e2..fc8c218f 100644 --- a/src/associations/has/has-many.ts +++ b/src/associations/has/has-many.ts @@ -5,11 +5,11 @@ import {ModelClassGetter} from "../../model/shared/model-class-getter"; import {addAssociation, getPreparedAssociationOptions} from "../shared/association-service"; import {Association} from "../shared/association"; -export function HasMany(associatedClassGetter: ModelClassGetter, foreignKey?: string): Function; +export function HasMany(associatedClassGetter: ModelClassGetter, foreignKey?: string): Function; -export function HasMany(associatedClassGetter: ModelClassGetter, options?: HasManyOptions): Function; +export function HasMany(associatedClassGetter: ModelClassGetter, options?: HasManyOptions): Function; -export function HasMany(associatedClassGetter: ModelClassGetter, optionsOrForeignKey?: string | HasManyOptions): Function { +export function HasMany(associatedClassGetter: ModelClassGetter, optionsOrForeignKey?: string | HasManyOptions): Function { return (target: any, propertyName: string) => { const options: HasManyOptions = getPreparedAssociationOptions(optionsOrForeignKey); diff --git a/src/associations/has/has-one.ts b/src/associations/has/has-one.ts index c25f0b8f..e45fa0e5 100644 --- a/src/associations/has/has-one.ts +++ b/src/associations/has/has-one.ts @@ -5,11 +5,11 @@ import {ModelClassGetter} from "../../model/shared/model-class-getter"; import {addAssociation, getPreparedAssociationOptions} from "../shared/association-service"; import {Association} from "../shared/association"; -export function HasOne(associatedClassGetter: ModelClassGetter, foreignKey?: string): Function; +export function HasOne(associatedClassGetter: ModelClassGetter, foreignKey?: string): Function; -export function HasOne(associatedClassGetter: ModelClassGetter, options?: HasOneOptions): Function; +export function HasOne(associatedClassGetter: ModelClassGetter, options?: HasOneOptions): Function; -export function HasOne(associatedClassGetter: ModelClassGetter, optionsOrForeignKey?: string | HasOneOptions): Function { +export function HasOne(associatedClassGetter: ModelClassGetter, optionsOrForeignKey?: string | HasOneOptions): Function { return (target: any, propertyName: string) => { const options: HasOneOptions = getPreparedAssociationOptions(optionsOrForeignKey); diff --git a/src/associations/shared/association-service.ts b/src/associations/shared/association-service.ts index 361124e9..f796d879 100644 --- a/src/associations/shared/association-service.ts +++ b/src/associations/shared/association-service.ts @@ -27,8 +27,8 @@ export function getPreparedAssociationOptions(optionsOrForeignKey?: string | Non /** * Stores association meta data for specified class */ -export function addAssociation(target: any, - association: BaseAssociation) { +export function addAssociation(target: any, + association: BaseAssociation) { let associations = getAssociations(target); @@ -42,20 +42,20 @@ export function addAssociation(target: any, /** * Returns association meta data from specified class */ -export function getAssociations(target: any): BaseAssociation[] | undefined { +export function getAssociations(target: any): BaseAssociation[] | undefined { const associations = Reflect.getMetadata(ASSOCIATIONS_KEY, target); if (associations) { return [...associations]; } } -export function setAssociations(target: any, associations: BaseAssociation[]) { +export function setAssociations(target: any, associations: BaseAssociation[]) { Reflect.defineMetadata(ASSOCIATIONS_KEY, associations, target); } -export function getAssociationsByRelation(target: any, - relatedClass: any): BaseAssociation[] { - const associations = getAssociations(target); +export function getAssociationsByRelation(target: any, + relatedClass: any): BaseAssociation[] { + const associations = getAssociations(target); return (associations || []).filter(association => { const _relatedClass = association.getAssociatedClass(); return ( diff --git a/src/associations/shared/base-association.ts b/src/associations/shared/base-association.ts index 1f6143fe..ae902dcd 100644 --- a/src/associations/shared/base-association.ts +++ b/src/associations/shared/base-association.ts @@ -1,20 +1,20 @@ import {UnionAssociationOptions} from './union-association-options'; import {Association} from './association'; import {ModelClassGetter} from "../../model/shared/model-class-getter"; -import {Model} from "../../model/model/model"; +import {ModelType} from "../../model/model/model"; import {Sequelize} from "../../sequelize/sequelize/sequelize"; -export abstract class BaseAssociation { +export abstract class BaseAssociation { - constructor(private associatedClassGetter: ModelClassGetter, + constructor(private associatedClassGetter: ModelClassGetter, protected options: UnionAssociationOptions) { } abstract getAssociation(): Association; - abstract getSequelizeOptions(model: typeof Model, + abstract getSequelizeOptions(model: ModelType, sequelize: Sequelize): UnionAssociationOptions; - getAssociatedClass(): typeof Model { + getAssociatedClass(): ModelType { return this.associatedClassGetter(); } diff --git a/src/associations/through/through-options.ts b/src/associations/through/through-options.ts index 6e1c2075..bf572385 100644 --- a/src/associations/through/through-options.ts +++ b/src/associations/through/through-options.ts @@ -1,8 +1,8 @@ import {ThroughOptions as OriginThroughOptions} from 'sequelize'; import {ModelClassGetter} from "../../model/shared/model-class-getter"; -export type ThroughOptions = { +export type ThroughOptions = { [K in keyof OriginThroughOptions]: K extends 'model' - ? ModelClassGetter | string + ? ModelClassGetter | string : OriginThroughOptions[K] }; diff --git a/src/model/model/model.ts b/src/model/model/model.ts index 92bd8086..f4bb38b5 100644 --- a/src/model/model/model.ts +++ b/src/model/model/model.ts @@ -8,8 +8,8 @@ import {AssociationCountOptions} from "./association/association-count-options"; import {AssociationActionOptions} from "./association/association-action-options"; import {AssociationCreateOptions} from "./association/association-create-options"; -export type ModelType = typeof Model; -export type ModelCtor = (new () => M) & ModelType; +export type ModelType = new (values?: TCreationAttributes, options?: any) => Model; +export type ModelCtor = (new () => M) & typeof Model; export type $GetType = NonNullable extends any[] ? NonNullable : (NonNullable | null); diff --git a/src/model/shared/model-class-getter.ts b/src/model/shared/model-class-getter.ts index 29200d8b..84ef5148 100644 --- a/src/model/shared/model-class-getter.ts +++ b/src/model/shared/model-class-getter.ts @@ -1,3 +1,3 @@ -import {Model} from "../model/model"; +import {ModelType} from "../model/model"; -export type ModelClassGetter = (returns?: void) => typeof Model; +export type ModelClassGetter = (returns?: void) => ModelType; diff --git a/src/scopes/default-scope.ts b/src/scopes/default-scope.ts index 19186570..5f498d3c 100644 --- a/src/scopes/default-scope.ts +++ b/src/scopes/default-scope.ts @@ -11,12 +11,12 @@ export function DefaultScope(scopeGetter: DefaultScopeGetter): Function; * Decorator for defining default Model scope * @deprecated */ -export function DefaultScope(scope: ScopeFindOptions): Function; +export function DefaultScope(scope: ScopeFindOptions): Function; /** * Decorator for defining default Model scope */ -export function DefaultScope(scopeOrSsopeGetter: ScopeFindOptions | DefaultScopeGetter): Function { +export function DefaultScope(scopeOrSsopeGetter: ScopeFindOptions | DefaultScopeGetter): Function { return (target: any) => { if (typeof scopeOrSsopeGetter === 'function') { addScopeOptionsGetter(target.prototype, {getDefaultScope: scopeOrSsopeGetter}); diff --git a/src/scopes/scope-find-options.ts b/src/scopes/scope-find-options.ts index 4902a9d0..f23dc624 100644 --- a/src/scopes/scope-find-options.ts +++ b/src/scopes/scope-find-options.ts @@ -1,16 +1,16 @@ import {Association, FindOptions, IncludeOptions} from "sequelize"; import {ModelClassGetter} from "../model/shared/model-class-getter"; -export type ScopeIncludeOptions = { +export type ScopeIncludeOptions = { [K in keyof IncludeOptions]: K extends 'model' - ? ModelClassGetter + ? ModelClassGetter : (K extends 'include' - ? ScopeIncludeOptions + ? ScopeIncludeOptions : IncludeOptions[K]) }; -export type ScopeFindOptions = { +export type ScopeFindOptions = { [K in keyof FindOptions]: K extends 'include' - ? ModelClassGetter[] | Association[] | ScopeIncludeOptions[] | { all: true } + ? ModelClassGetter[] | Association[] | ScopeIncludeOptions[] | { all: true } : FindOptions[K] }; diff --git a/src/scopes/scope-options.ts b/src/scopes/scope-options.ts index 962cdee4..5fef3700 100644 --- a/src/scopes/scope-options.ts +++ b/src/scopes/scope-options.ts @@ -2,8 +2,8 @@ import {ScopeTableOptions} from './scope-table-options'; import {ScopeFindOptions} from "./scope-find-options"; import {FindOptions} from "sequelize"; -export interface ScopeOptions extends ScopeTableOptions { - defaultScope?: ScopeFindOptions; +export interface ScopeOptions extends ScopeTableOptions { + defaultScope?: ScopeFindOptions; } export interface ScopeOptionsGetters { diff --git a/src/scopes/scope-service.ts b/src/scopes/scope-service.ts index 9012a338..b5d25193 100644 --- a/src/scopes/scope-service.ts +++ b/src/scopes/scope-service.ts @@ -70,7 +70,7 @@ export const resolvesDeprecatedScopes = (model: ModelCtor) => { * Adds scope option meta data for specified prototype * @deprecated */ -export function addScopeOptions(target: any, options: ScopeOptions): void { +export function addScopeOptions(target: any, options: ScopeOptions): void { const _options = getScopeOptions(target) || {}; setScopeOptions(target, deepAssign({}, _options, options)); } @@ -79,7 +79,7 @@ export function addScopeOptions(target: any, options: ScopeOptions): void { * Returns scope option meta data from specified target * @deprecated */ -export function getScopeOptions(target: any): ScopeOptions | undefined { +export function getScopeOptions(target: any): ScopeOptions | undefined { const options = Reflect.getMetadata(SCOPES_KEY, target); if (options) { return deepAssign({}, options); @@ -89,7 +89,7 @@ export function getScopeOptions(target: any): ScopeOptions | undefined { /** * @deprecated */ -function resolveDeprecatedScope(scopeName: string, model: ModelCtor, options: ScopeFindOptions | Function | undefined): void { +function resolveDeprecatedScope(scopeName: string, model: ModelCtor, options: ScopeFindOptions | Function | undefined): void { if (typeof options === 'function') { const fn: Function = options; options = (...args: any[]) => inferAlias(fn(...args), model); @@ -103,6 +103,6 @@ function resolveDeprecatedScope(scopeName: string, model: ModelCtor, options: Sc * Set scope option meta data for specified prototype * @deprecated */ -function setScopeOptions(target: any, options: ScopeOptions): void { +function setScopeOptions(target: any, options: ScopeOptions): void { Reflect.defineMetadata(SCOPES_KEY, options, target); } diff --git a/src/scopes/scope-table-options.ts b/src/scopes/scope-table-options.ts index 052a220b..54b0dff2 100644 --- a/src/scopes/scope-table-options.ts +++ b/src/scopes/scope-table-options.ts @@ -1,5 +1,5 @@ import {ScopeFindOptions} from "./scope-find-options"; -export interface ScopeTableOptions { - [scopeName: string]: ScopeFindOptions | Function | undefined; +export interface ScopeTableOptions { + [scopeName: string]: ScopeFindOptions | Function | undefined; } diff --git a/src/scopes/scopes.ts b/src/scopes/scopes.ts index 6cff170b..3ad04d41 100644 --- a/src/scopes/scopes.ts +++ b/src/scopes/scopes.ts @@ -11,12 +11,12 @@ export function Scopes(scopesGetter: ScopesOptionsGetter): Function; * Decorator for defining Model scopes * @deprecated */ -export function Scopes(scopes: ScopeTableOptions): Function; +export function Scopes(scopes: ScopeTableOptions): Function; /** * Decorator for defining Model scopes */ -export function Scopes(scopesOrScopesGetter: ScopeTableOptions | ScopesOptionsGetter): Function { +export function Scopes(scopesOrScopesGetter: ScopeTableOptions | ScopesOptionsGetter): Function { return (target: any) => { if (typeof scopesOrScopesGetter === 'function') { addScopeOptionsGetter(target.prototype, { diff --git a/src/sequelize/sequelize/sequelize.ts b/src/sequelize/sequelize/sequelize.ts index acc18fa3..86d4fd2b 100644 --- a/src/sequelize/sequelize/sequelize.ts +++ b/src/sequelize/sequelize/sequelize.ts @@ -2,7 +2,7 @@ import {InitOptions, Sequelize as OriginSequelize} from 'sequelize'; import {ModelNotInitializedError} from "../../model/shared/model-not-initialized-error"; import {ModelMatch, SequelizeOptions} from "./sequelize-options"; import {getModels, prepareArgs} from "./sequelize-service"; -import {Model, ModelCtor} from "../../model/model/model"; +import {Model, ModelCtor, ModelType} from "../../model/model/model"; import {getModelName, getOptions} from "../../model/shared/model-service"; import {resolveScopes} from "../../scopes/scope-service"; import {installHooks} from "../../hooks/shared/hooks-service"; @@ -33,7 +33,7 @@ export class Sequelize extends OriginSequelize { } } - model(model: string | typeof Model): ModelCtor { + model(model: string | ModelType): ModelCtor { if (typeof model !== 'string') { return super.model(getModelName(model.prototype)) as ModelCtor; }