Cannot find module '@sequelize/core/decorators-legacy' or its corresponding type declarations. #16425
-
Hi everyone. I was working on a project with Apollo and I keep all my packages up to date. So I switched to TypeScript 5.2 except that Sequelize V6 doesn't seem fully compatible, and I was getting errors when compiling the code. Looking at this Sequelize GitHub issue, it says this is fixed with Sequelize version 7. Seeing that there's a lot of change with version 6 (especially class with decorators instead of I installed https://sequelize.org/api/v7/modules/_sequelize_core.html However, any IDE and even the compiler tell me they can't find the @sequelize/core/decorators-legacy module. Has anyone ever found themselves in this situation? Here is a snap of my {
"dependencies": {
...,
"@sequelize/core": "^7.0.0-alpha.27",
...
},
"devDependencies": {
...,
"sequelize-cli": "^6.6.1",
"typescript": "5.2.2"
...
}
} And here one of my model import {
Model,
InferAttributes,
InferCreationAttributes,
CreationOptional,
DataTypes,
} from "@sequelize/core";
import {
Attribute,
PrimaryKey,
AutoIncrement,
NotNull,
Index,
} from "@sequelize/core/decorators-legacy";
export class Visibility extends Model<
InferAttributes<Visibility>,
InferCreationAttributes<Visibility>
> {
@Attribute(DataTypes.INTEGER)
@PrimaryKey
@AutoIncrement
declare id: CreationOptional<number>;
@Attribute(DataTypes.STRING)
@NotNull
@Index({ unique: true })
declare name: string;
@Attribute(DataTypes.TEXT)
declare description: string;
} Thanks if someone has a solution |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I was also having this issue; while this may not help in your case, I ended up using require instead of import and it worked for me.
|
Beta Was this translation helpful? Give feedback.
-
This is likely the problem you're experiencing: sequelize/website#552, see the comments for the solution |
Beta Was this translation helpful? Give feedback.
This is likely the problem you're experiencing: sequelize/website#552, see the comments for the solution