-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat(types): make Model.getAttributes
stricter
#14017
Conversation
Model.getAttributes
stricter
EDIT2: My phone didn't show that this was already in the v6 project so nevermind that. The expiring TODO is still nice to add EDIT: in any case, this is a nice usage for expiring TODOs |
I don't think we'll remove it in v7 because I think it's widely used. Maybe v8 |
Hm, a bit biased but the script I made (which I've yet to adapt for general sequelize usage) uses I'd also be hesitant to touch |
Edit: I've reworded this comment because my previous iteration was a bit hard to read I don't think this PR would interfere with your script, you can still override This would bring typings closer to reality for users that are not using your script, while still letting your script provide even stronger types. Regarding first typing
I don't think we'll be able to make TS infer everything. I mean we could, using even more Branded Types, but it'd be verbose. I'm not against it at all, but baby steps. |
I think I like it :) |
🎉 This PR is included in version 7.0.0-alpha.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Pull Request Checklist
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description Of Change
Follow up to #13728
The typings for
Model.getAttributes
now declare returning an object where the keys are the attributes declared on the model.This PR deprecates
Model.rawAttributes
& recommends usingModel.getAttributes
instead. I've done this because we cannot strictly typerawAttributes
.