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
(sequelize) Warning: Model "ExpenseItem" is declaring public class fields for attribute(s): "id", "amount", "url", "description", "createdAt", "updatedAt", "deletedAt", "incurredAt", "ExpenseId", "CreatedByUserId".
These class fields are shadowing Sequelize's attribute getters & setters.
See https://sequelize.org/main/manual/model-basics.html#caveat-with-public-class-fields
(sequelize) Warning: Model "PayoutMethod" is declaring public class fields for attribute(s): "id", "type", "data", "createdAt", "updatedAt", "deletedAt", "name", "isSaved", "CollectiveId", "CreatedByUserId".
These class fields are shadowing Sequelize's attribute getters & setters.
See https://sequelize.org/main/manual/model-basics.html#caveat-with-public-class-fields
I think there's no risk on our side since the restoreSequelizeAttributesOnClass helper is supposed to restore Sequelize's getters and setters. But there might be a better way to do that nowadays, it's a good time to dig again.
Betree
added
the
api
Issues that require some work on the API (https://github.com/opencollective/opencollective-api)
label
Jan 7, 2022
Note that we've since learned that babel ignores declare if the class field is decorated (sequelize/sequelize#14300). restoreSequelizeAttributesOnClass is the right solution if declare does not work and we can add a flag to mute the warning if it's annoying
@ephys Interesting! We don't use decorators right now, so this should work for us. I started a PR to experiment with this in opencollective/opencollective-api#7558; overall things are looking good! I still have an issue in the ExpenseItem model, where somehow the model attributes still appear as undefined even though we use declare. I'll dig some more on that.
Great job on the docs BTW, when we first introduced Typescript I remember that Sequelize's docs were not super complete and I was super happy this time with all the explanations and workarounds proposed in https://sequelize.org/docs/v6/other-topics/typescript/.
https://sequelize.org/main/manual/model-basics.html#caveat-with-public-class-fields
Seems this is affecting the classes built with typescript.
The text was updated successfully, but these errors were encountered: