profile
viewpoint

Ask questionsSupport for Sequelize v6

<!-- Before submitting an issue, please consult our docs (https://github.com/RobinBuschmann/sequelize-typescript) and check whether your problem was already reported (https://github.com/RobinBuschmann/sequelize-typescript/issues) -->

<!-- Please make sure you are posting an issue pertaining to sequelize-typescript. If you are having an issue with sequelize itself, please consult the sequelize team (https://github.com/sequelize/sequelize/issues) -->

Versions <!-- Please let us know which sequelize, sequelize-typescript and typescript version are you using -->

  • sequelize: 6.2.0
  • sequelize-typescript: 1.1.0
  • typescript: 3.9.5

I'm submitting a ... <!-- (check one with "x") --> [x] bug report [ ] feature request

Details:

There is a new major Sequelize release v6 that changes Sequelize's internals quite a bit (for example removing Bluebird, yey!)

These are the types errors that I get running it against this version:


node_modules/sequelize-typescript/dist/associations/belongs-to-many/belongs-to-many-association.d.ts:12:5 - error TS2416: Property 'getSequelizeOptions' in type 'BelongsToManyAssociation' is not assignable to the same property in base type 'BaseAssociation'.
  Type '(model: typeof import(".../node_modules/sequelize/types/lib/model").Model, sequelize: import(".../node_modules/sequelize-typescript/dist/sequelize/sequelize/sequelize").Sequelize) => import(".../node_modules/sequeli...' is not assignable to type '(model: typeof import(".../node_modules/sequelize-typescript/dist/model/model/model").Model, sequelize: import(".../node_modules/sequelize-typescript/dist/sequelize/sequelize/sequelize").Sequelize) => import(".../no...'.
    Types of parameters 'model' and 'model' are incompatible.
      Type 'typeof import(".../node_modules/sequelize-typescript/dist/model/model/model").Model' is not assignable to type 'typeof import(".../node_modules/sequelize/types/lib/model").Model'.
        Types of property 'init' are incompatible.
          Type '(attributes: ModelAttributes<Model<any, any>, any>, options: InitOptions<Model<any, any>>) => void' is not assignable to type '<M extends Model<any, any>>(this: ModelStatic<M>, attributes: ModelAttributes<M, M["_creationAttributes"]>, options: InitOptions<M>) => Model<...>'.

12     getSequelizeOptions(model: typeof Model, sequelize: Sequelize): UnionAssociationOptions;
       ~~~~~~~~~~~~~~~~~~~

node_modules/sequelize-typescript/dist/associations/has/has-association.d.ts:11:5 - error TS2416: Property 'getSequelizeOptions' in type 'HasAssociation' is not assignable to the same property in base type 'BaseAssociation'.
  Type '(model: typeof Model) => UnionAssociationOptions' is not assignable to type '(model: typeof Model, sequelize: Sequelize) => UnionAssociationOptions'.
    Types of parameters 'model' and 'model' are incompatible.
      Type 'typeof import(".../node_modules/sequelize-typescript/dist/model/model/model").Model' is not assignable to type 'typeof import(".../node_modules/sequelize/types/lib/model").Model'.

11     getSequelizeOptions(model: typeof Model): UnionAssociationOptions;
       ~~~~~~~~~~~~~~~~~~~

node_modules/sequelize-typescript/dist/model/model/model.d.ts:1:89 - error TS2305: Module '"../../../../sequelize/types"' has no exported member 'Promise'.

1 import { InitOptions, Model as OriginModel, ModelAttributes, FindOptions, BuildOptions, Promise } from 'sequelize';
                                                                                          ~~~~~~~

node_modules/sequelize-typescript/dist/model/model/model.d.ts:9:31 - error TS2417: Class static side 'typeof import(".../node_modules/sequelize-typescript/dist/model/model/model").Model' incorrectly extends base class static side 'typeof import(".../node_modules/sequelize/types/lib/model").Model'.
  The types returned by 'init(...)' are incompatible between these types.
    Type 'void' is not assignable to type 'Model<any, any>'.

9 export declare abstract class Model<T = any, T2 = any> extends OriginModel<T, T2> {
                                ~~~~~

node_modules/sequelize-typescript/dist/sequelize/sequelize/sequelize.d.ts:12:5 - error TS2416: Property 'model' in type 'Sequelize' is not assignable to the same property in base type 'Sequelize'.
  Type '(model: string | typeof Model) => ModelCtor<Model<any, any>>' is not assignable to type '(modelName: string) => ModelCtor<Model<any, any>>'.
    Type 'import(".../node_modules/sequelize-typescript/dist/model/model/model").ModelCtor<import(".../node_modules/sequelize-typescript/dist/model/model/model").Model<any, any>>' is not assignable to type 'import(".../node_modules/sequelize/types/lib/model").ModelCtor<import(".../node_modules/sequelize/types/lib/model").Model<any, any>>'.
      Type 'ModelCtor<Model<any, any>>' is not assignable to type 'typeof Model'.
        The types returned by 'init(...)' are incompatible between these types.
          Type 'void' is not assignable to type 'Model<any, any>'.

12     model(model: string | typeof Model): ModelCtor;
       ~~~~~

src/cli.ts:75:21 - error TS2345: Argument of type 'import(".../node_modules/sequelize-typescript/dist/sequelize/sequelize/sequelize").Sequelize' is not assignable to parameter of type 'import(".../node_modules/sequelize/types/lib/sequelize").Sequelize'.
  The types returned by 'model(...)' are incompatible between these types.
    Type 'import(".../node_modules/sequelize-typescript/dist/model/model/model").ModelCtor<import(".../node_modules/sequelize-typescript/dist/model/model/model").Model<any, any>>' is not assignable to type 'import(".../node_modules/sequelize/types/lib/model").ModelCtor<import(".../node_modules/sequelize/types/lib/model").Model<any, any>>'.
      Type 'ModelCtor<Model<any, any>>' is not assignable to type 'typeof Model'.

75     await initStore(sequelize)
                       ~~~~~~~~~


Found 6 errors.
RobinBuschmann/sequelize-typescript

Answer questions sarfarazansari

any idea how to fix this

useful!
source:https://uonfu.com/
answerer
Sarfaraz Ansari sarfarazansari @viasocket @Walkover-Web-Solution Indore https://sarfarazansari.github.io/ A Furious Front End Developer Who is trying to make WWW World better
Github User Rank List