-
Notifications
You must be signed in to change notification settings - Fork 286
v2.0.0: compiler error when using stricter typing Model attributes signature #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @spinlud, thanks for reporting. This doesn't seem to be a sequelize-typescript (only) issue. Similar code also throws a compiler error with pure sequelize: import {Model} from 'sequelize';
class Test extends Model<{test: string}> {}
class Test2 extends Model {}
Test2.findAll({
include: [Test], // fails here
});
Can anyone confirm? The source of the problem seems to be the default value of generic TCreationAttributes in the definition of See following example: class Model<TModelAttributes = any, TCreationAttributes = TModelAttributes> {
constructor(values?: TCreationAttributes) {}
}
class Test extends Model<{test: string}> {}
const addModel = (model: typeof Model) => {};
addModel(Test); (see in typescript playground) I'm considering to just use |
@RobinBuschmann I can confirm I'm seeing the same error with just Found a related issue on the sequelize side: |
It seems like, for now the only workaround is to use |
@AlexanderProd Yes, I've been ignoring the errors, didn't run into any problems yet. -edit- |
@RoelVB |
@AlexanderProd I just tested [email protected] with [email protected] and the problem described in this issue disappeared. I only noticed the typings issue is still there with includes. This is waiting for sequelize/sequelize#13010 |
Issue should be fixed in sequelize 6.6.1, please verify. @divlo |
Apologies for the delay. I've also updated sequelize-typescript-generator to leverage the strict mode as well. |
It seems there are still problems when defining models with stricter typing syntax on attributes, as already reported here #844.
The following code does not compile:
See also:
The text was updated successfully, but these errors were encountered: