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
fix(types): accept $nested.syntax$
in WhereAttributeHash
#13983
Conversation
TypeScript < 4.4 does not support using Template Literal Types as keys so I had to ts-ignore both the test & the implementation - but it doesn't cause issues in ts < 4.4 and works in ts >= 4.4 We can enable it again on 2022-05-26 when we drop support for TS < 4.4 |
I think with some more black magic we should be able to typecheck User.findOne({
include: [{
association: User.associations.group,
where: {
// these are not currently type-checked
test: 'test',
}
}],
}); |
…uelize/sequelize into ephys/find-accepts-include-reference
This PR should also include support for the JSON nested key syntax https://sequelize.org/v4/manual/tutorial/querying.html#nested-key I can't find the documentation on that syntax for v6. Is it still a thing?
Edit: I've found a place where it was used in Edit 2: And in We should improve the documentation to reflect this I wonder if |
It seems that it got lost in #11825 |
$nested.syntax$
and json.syntax
in WhereAttributeHash
$nested.syntax$
and json.syntax
in WhereAttributeHash$nested.syntax$
in WhereAttributeHash
I'll open a follow-up PR for the |
As the only issue is that the false-positive is still present in TS < 4.4, I think I'll merge this (tomorrow or friday to still leave some time to react). Then we can fix #14038, and then open a follow-up PR that uses |
Sounds good! We should also publish a new alpha release of v7 after we merged all these typing PRs |
@WikiRik @allawesome497 if you're ok with the above plan, can I get one of your review approvals? :) |
🎉 This PR is included in version 7.0.0-alpha.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Pull Request Checklist
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description Of Change
Tiny change that has become possible since we dropped TS < 4.1:
User.findOne({ where: { '$nested.column$': 'blah2' } })
is not reported as an error by TypeScript anymore.Closes #13288
TODO
$name$
is valid$include.include.name$
is valid