You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The call to Message.create fails with the following error.
The 'this' context of type 'typeof Message' is not assignable to method's 'this' of type '(new () => Message) & typeof Model'
I'm suffering from the fact that I'm not well versed in TypeScript and this error message is not transparent to me.
(new () => Message) seems to be the type signature that would describe a constructor/class that returns Message type objects. In which case, that should be satisfied by the fact that this is the Message class.
typeof Model which would presumably be equivalent to (new () => Model). I would have imagined that this was also satisfied because the Message class inherits from the model class.
I'm in the process of converting existing Sequelize code to TypeScript and so I expect that one of the abstractions already in place is tripping me up. Either way, it would be great to have a reference example of a typed model definition that includes these kind of methods.
The text was updated successfully, but these errors were encountered:
Not sure whether I'm missing something really obvious here, but my models don't type check if I refer to the model classes within their methods.
The call to
Message.create
fails with the following error.I'm suffering from the fact that I'm not well versed in TypeScript and this error message is not transparent to me.
(new () => Message)
seems to be the type signature that would describe a constructor/class that returnsMessage
type objects. In which case, that should be satisfied by the fact that this is the Message class.typeof Model
which would presumably be equivalent to(new () => Model)
. I would have imagined that this was also satisfied because the Message class inherits from the model class.I'm in the process of converting existing Sequelize code to TypeScript and so I expect that one of the abstractions already in place is tripping me up. Either way, it would be great to have a reference example of a typed model definition that includes these kind of methods.
The text was updated successfully, but these errors were encountered: