sequelize-auto
sequelize-auto copied to clipboard
a bug when generate Attributes
I think there might be a bug here: sequelize-auto/src/auto-generator.ts line 103.
With TypeScript, when using find method such as
MyModel.findOne({ where: { username: "user1" } })
IDE always prompts like this:
Type '{ username: string; }' is missing the following properties from type 'WhereAttributeHash<MyModelAttributes>': id, passwd, create_time ...
Because MyModelAttributes are not optional:
export interface MyModelAttributes {
id: number
username: string
passwd: number
create_time: Date
// more...
}
So I think optional attributes should always be generated there.
An issue for reference: https://github.com/sequelize/sequelize/issues/12716