V7 inheritance demo gives Typescript error #16953
Unanswered
JamieS1211
asked this question in
Help & Questions
Replies: 2 comments 1 reply
-
I also encountered this problem 😞 |
Beta Was this translation helpful? Give feedback.
0 replies
-
@Table.Abstract
export abstract class Player<M extends Player<M>> extends Model<InferAttributes<M>, InferCreationAttributes<M>> {
@PrimaryKey
@AutoIncrement
@Attribute(DataTypes.INTEGER)
declare id: CreationOptional<number>;
}
@Table.Abstract
export class User<M extends TenantBase<M>> extends Player<M> {
@NotNull
@Attribute(DataTypes.STRING)
declare name: string;
}
export class Test extends UserBase<Test> {
@NotNull
@Attribute(DataTypes.STRING)
declare userinfo: string;
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there, I have just started migrating over to sequelize 7 and have run into an issue with the example for model inheritance.
The documentation can be found here- https://sequelize.org/docs/v7/models/inheritance/
The example suggests for the abstract class to be:
However when doing this I get a typescript error:
If you have any advice here would be fantastic as I am totally stumped. I agree with your example but it IS circular and if thats an issue for typescript not sure what to do sort of "ts-ignore" 🤮
Beta Was this translation helpful? Give feedback.
All reactions