feat: audit "as any as" usage and prefer it over "as unknown as"#144
Conversation
cb06370 to
5f79b57
Compare
|
Okay, now I feel I have addressed the preference for explicitness |
But I still see the I like all the changes in the PR, but I still question the need for this rule to exist? |
|
I see! My point with this PR is that:
I think the fact that working around this rule as a first option, rather than disabling the rule on each line, resulted in:
is an indicator that the approach can be useful |
|
Ah but maybe I don't see. Are you of the opinion that doing |
frodi-karlsson
left a comment
There was a problem hiding this comment.
And places like it
| if (isPartialQuery) return pipeline as any as Pipeline<BM> | ||
| // oxlint-disable-next-line nc/no-as-x-as -- We want to lie here, to avoid the overhead of converting DBM to BM when it's a partial query (since we don't have all the data to create a full BM anyway). | ||
| if (isPartialQuery) return pipeline as unknown as Pipeline<BM> |
There was a problem hiding this comment.
And here's where I concede to keeping it, as it's the best way to solve the problems, but the comment just makes it even more explicit
No. I'm not against accurate types, and I like the typing improvements in this PR very much! What I don't like is when the linter would shout at But also - I do like your work at adopting Does it make sense? |
|
Even more TLDR: I like I like correct types when it's easy, but when it's not - I like |
|
Alright ✅ |
|
TLDR: my argument for the rule is that it's a pattern that should be motivated, which a lint rule enforces (via suppression) I will revert the rule and change to just the improvements |
|
I see that if we align all to |
…nstead of unknown
kirillgroshkov
left a comment
There was a problem hiding this comment.
LGTM, but there's a file I don't understand
|
🎉 This PR is included in version @naturalcycles/dev-lib-v20.49.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version @naturalcycles/js-lib-v15.78.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version @naturalcycles/db-lib-v10.54.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version @naturalcycles/nodejs-lib-v15.111.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version @naturalcycles/airtable-lib-v4.17.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version @naturalcycles/mongo-lib-v4.9.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version @naturalcycles/sqlite-lib-v2.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
tightening the sort of type shortcuts that are available to us