Sequelize-typescript: Sequelize v5.13.0 not supported

Created on 9 Aug 2019  路  12Comments  路  Source: RobinBuschmann/sequelize-typescript

Versions

  • sequelize: 5.13.0
  • sequelize-typescript: 1.0.0-beta.3
  • typescript: 3.5.3

I'm submitting a ...

[ x] bug report
[ ] feature request

Actual behavior:

Unable to build project. See below for tsc output...

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) => typeof Model' is not assignable to type '(modelName: string) => ModelCtor<Model<any, any>>'.
    Type 'typeof Model' is not assignable to type 'ModelCtor<Model<any, any>>'.
      Type 'typeof Model' is not assignable to type 'new () => Model<any, any>'.
        Cannot assign an abstract constructor type to a non-abstract constructor type.

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

Expected behavior:

I assume this should work. The documentation says sequelize v5 is supported. I have reverted back to sequelize v5.12.3 and all seems happy.

Steps to reproduce:

Upgrade to sequelize v5.13.0 and try to build.

Most helpful comment

Hey @justinlottes, thanks for reporting. Just published a new beta version. ([email protected] or sequelize-typescript@next). Can you confirm that its working with this one?

All 12 comments

I had a same issue. in my case I used sequelize-typescript@^1.0.0-beta.3, [email protected].

I don't know exact cause but I fixed this issue by changing [email protected] to [email protected] as I noticed sequelize-typescript@^1.0.0-beta.3 internally use [email protected]. I know this is temporary solution and hope this issue to be fixed asap

@zeroFruit I tried your solution but when using mssql dialect and hitting any of my endpoints it kept throwing some error from the connection-manager.js:
Unhandled rejection SequelizeConnectionError: Invalid arguments: "instanceName" must be a string

However with [email protected], [email protected], and [email protected] everything seems to function as intended. In my setup ts-node-dev ends up using ts-node version 8.3.0, typescript version 3.5.3 to server everything up.

@budhead2004

  1. your code build successfully (ts -> js) ?
  2. your mssql connection code runs on ts file?

Hey @justinlottes, thanks for reporting. Just published a new beta version. ([email protected] or sequelize-typescript@next). Can you confirm that its working with this one?

It works on my side. Thanks @RobinBuschmann

Worked for me too.

Works for me. Thanks!

@RobinBuschmann I actually am having trouble getting this to work. I pulled the latest from sequelize-typescript@next and the thing is I can see in the code that interfaces/* should be exported via index.ts _but_ I'm not seeing it show up when I actually install the folder into my node_modules

Screen Shot 2019-08-20 at 5 05 09 PM

Is it possible that not all folders (such as interfaces) are being properly exposed when you distribute the plugin?

@RobinBuschmann [email protected] solve compilation error ^^

I have the same issue with sequelize latest version ^6.3.3 that is published 10 days ago, where it is fine with older verions[^5.22.3].

It's 23/08/2020 for now I don't have problems with:

"sequelize": "^5.22.3",
"sequelize-typescript": "^1.0.0-beta.4"

All I have done to overlap this problem is to force the type of dialect to be the same of Dialect manually, like:

import { Dialect, Sequelize } from "sequelize";

new Sequelize(
  ...some configs,
  {
    ...,
    dialect: 'mysql' as Dialect
  }
);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nandox5 picture nandox5  路  3Comments

samanmohamadi picture samanmohamadi  路  5Comments

josecolella picture josecolella  路  4Comments

fareshan picture fareshan  路  4Comments

bschveitzer picture bschveitzer  路  5Comments