Open
Description
Why don't we have generic for the model attributes?
e.g.
interface TypedModelAttributes {
id: number;
optionalData?: object;
}
class TypedModel extends Model<TypedModelAttributes> {
...
}
// usage
TypedModel.build({ ... }) // will be type-checked by "TypedModelAttributes"
TypedModel.findOne({ where: { ... }) // will be type-checked by "keyof TypedModelAttributes"
...
It is more accurate and will bring a lot of conveniences than current <K extends keyof this>
way.
Metadata
Metadata
Assignees
Labels
No labels