Is sequelize v6 compatibility still in beta? Any ETA?
+1
+1
+1
+1
Apparently @next allow sequelize v6 compatibility #787
Any update @RobinBuschmann ? 🙏🏼
Most likely this pull request added support for v6 compatibility #807.
What need to be done, to fully release [email protected] (as a stable release) ? @RobinBuschmann
Maybe we can help, to get this thing done! 🚀
v6.2 introduced some breaking changes to types mostly. You can try #856 for latest (v6.3.5) support
We tried to work with sequelize-typescript@next (2.0-beta) with Nest-Js, it works with sequelize v6.1. @RobinBuschmann we can help you to release v6.3.5 compatibility @lukashroch @Divlo 🤷🏼♂️
As discussed in #871.
I installed [email protected] in my project and I've got many TypeScript errors...
It seems like it stills doesn't work.

Can you show us the « Invitation » model ?
I think it’s because you extends Model in your file like extends Model
Looks like you're using old v5 class declaration. You must update all models to reflect v6 changes.
Yes, am I doing something wrong ? @goalia

@Divlo, check out #865, it describes the changes for model declarations
Thanks @lukashroch! It solves the problem. :+1:
I was testing the latest beta 2.0.0-beta.1, the following works with just sequelize v6.3.5:
import { Sequelize, Optional, Model, DataTypes } from 'sequelize';
interface PersonAttributes {
id: number;
name: string;
country?: string;
}
interface PersonCreationAttributes extends Optional<PersonAttributes, 'country'> {}
class Person extends Model<PersonAttributes, PersonCreationAttributes> implements PersonAttributes {
id!: number;
name!: string;
country?: string;
}
(async () => {
const sequelize = new Sequelize({
dialect: 'mysql',
host: 'localhost',
port: 3306,
database: 'testdb',
username: 'admin',
password: 'admin',
logQueryParameters: true,
logging: true,
});
await sequelize.authenticate();
Person.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
},
name: {
type: DataTypes.STRING,
allowNull: false
},
country: {
type: DataTypes.STRING,
allowNull: true
}
}, {
tableName: 'Person',
sequelize
});
await sequelize.sync();
const p = new Person({
id: 1,
name: 'Ken'
});
await p.save();
const persons = await Person.findAll();
console.log(persons);
await sequelize.close();
})();
The following does not work, using sequelize-typscript:
import { Optional } from 'sequelize';
import { Sequelize, Model } from "sequelize-typescript";
interface PersonAttributes {
id: number;
name: string;
country?: string;
}
interface PersonCreationAttributes extends Optional<PersonAttributes, 'country'> {}
class Person extends Model<PersonAttributes, PersonCreationAttributes> implements PersonAttributes {
id!: number;
name!: string;
country?: string;
}
(async () => {
const sequelize = new Sequelize({
dialect: 'mysql',
host: 'localhost',
port: 3306,
database: 'testdb',
username: 'admin',
password: 'admin',
logQueryParameters: true,
logging: true,
});
await sequelize.authenticate();
await sequelize.addModels([Person]); // <-- compiler complains
await sequelize.sync();
const p = new Person({
id: 1,
name: 'Ken'
});
await p.save();
const persons = await Person.findAll();
console.log(persons);
await sequelize.close();
})();

Am I missing something?
Hello @spinlud, you need to replace the following:
class Person extends Model<PersonAttributes, PersonCreationAttributes> implements PersonAttributes
by class Person extends Model implements PersonAttributes
Normally, it should work properly 🎉 (checkout #865 for more details)
@goalia thanks but this solution doesn't provide type checking on model creation, which I guess is the main reason to extends Model<ModelAttributes, ModelCreationAttributes> signature. Is there any ongoing work on this?
@spinlud https://github.com/sequelize/sequelize/pull/11820
This PR was created a long time ago. I'm not sure what to do :/
@antonstjernquist it looks like that that PR was left unmerged, this one has been merged instead https://github.com/sequelize/sequelize/pull/12405.
There is this other PR https://github.com/RobinBuschmann/sequelize-typescript/pull/868 which seems trying to fix issue about Model generics signature
[email protected] has been released! :smile:
If you encounter bugs, feel free to open new issues!
Most helpful comment
Most likely this pull request added support for v6 compatibility #807.
What need to be done, to fully release
[email protected](as a stable release) ? @RobinBuschmannMaybe we can help, to get this thing done! 🚀