Solvedsequelize typescript Type 'typeof Player' is not assignable to type 'typeof Model'
✔️Accepted Answer
You can use sequelize^6.3.5
+ sequelize-typescript^2.0.0-beta.1
, you only need to remove argument from Model<...>
:
-export class Team extends Model<Team> {
+export class Team extends Model {
Thanks to @lukashroch for updated docs: https://github.com/lukashroch/sequelize-typescript/tree/sequelize6-docs#v6-model-definition-less-strict
Other Answers:
It's related to sequelize@6.3.5. I have the same issue with both sequelize-typescript @1.1.0 & @2.0.0-beta.0
If I downgrade to sequelize@5.22.0 the issue is gone.
It must be a change in the sequelize Model type which is not compatible with the decorators typing.
Already reported in: #828, #826, #821 #813
Looks like using sequelize@6.1.1 solve the issue for now, which is the last version of sequelize with Model type compatible with sequelize-typescript.
I have the same problem with
"sequelize": "^6.3.5", "sequelize-typescript": "^2.0.0-beta.0"and
"sequelize": "^6.1.1", "sequelize-typescript": "^2.0.0-beta.0"resolved with downgrade to
"sequelize": "^5.22.0", "sequelize-typescript": "^1.1.0"
Thanks your proposal can solve the issue
Hello @Austine105, did you found any solution for this issue ? I have the same problem with nest.js
Same here, @RobinBuschmann any idea what's going on?
Versions
I'm submitting a ...
[X] bug report
[ ] feature request
Actual behavior:
I have added 2 class files, Player.ts and Team.ts as per the example. In each of the references:
and
The Team and the Player following the => on the attribute is underlines in red in VS code with the error:
Expected behavior:
No Errors
Steps to reproduce:
Added Player.ts with the sample code provided in the readme.md, and Team.ts in the same way
Related code:
Player.ts
Team.ts