I'm trying to deploy nestJs with sequelize using typescript.
I am following this tutorial:
https://docs.nestjs.com/techniques/database#sequelize-integration
[00:22:10] Starting compilation in watch mode...
node_modules/sequelize-typescript/dist/model/model/model.d.ts:10:31 - error TS2417: Class static side 'typeof import("/var/www/vhosts/curem/temp/node_modules/sequelize-typescript/dist/model/model/model").Model' incorrectly extends base class static side 'typeof import("/var/www/vhosts/curem/temp/node_modules/sequelize/types/lib/model").Model'.
The types returned by 'init(...)' are incompatible between these types.
Type 'Model<any, any>' is not assignable to type 'MS'.
'MS' could be instantiated with an arbitrary type which could be unrelated to 'Model<any, any>'.
10 export declare abstract class Model<TModelAttributes extends {} = any, TCreationAttributes extends {} = TModelAttributes> extends OriginModel<TModelAttributes, TCreationAttributes> {
~~~~~
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 '<TCreationAttributes, TModelAttributes>(model: string | ModelType<TCreationAttributes, TModelAttributes>) => ModelCtor<Model<any, any>>' is not assignable to type '(modelName: string) => ModelCtor<Model<any, any>>'.
Type 'import("/var/www/vhosts/curem/temp/node_modules/sequelize-typescript/dist/model/model/model").ModelCtor<import("/var/www/vhosts/curem/temp/node_modules/sequelize-typescript/dist/model/model/model").Model<any, any>>' is not assignable to type 'import("/var/www/vhosts/curem/temp/node_modules/sequelize/types/lib/model").ModelCtor<import("/var/www/vhosts/curem/temp/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 'Model<any, any>' is not assignable to type 'MS'.
'MS' could be instantiated with an arbitrary type which could be unrelated to 'Model<any, any>'.
12 model<TCreationAttributes, TModelAttributes>(model: string | ModelType<TCreationAttributes, TModelAttributes>): ModelCtor;
~~~~~
[00:22:13] Found 2 errors. Watching for file changes.
does anyone know how to fix this error?
I was just seeing this problem, it is related to the last version they released of sequalize.
Try the version:
"sequelize": "6.6.2"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With