platform
platform copied to clipboard
feat(store): strict projectors
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/ngrx/platform/blob/master/CONTRIBUTING.md#commit
- [x] Tests for the changes have been added (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:
What is the current behavior?
Closes #3571
What is the new behavior?
The projector is strict by default, but can be bypassed with an any generic parameter.
Does this PR introduce a breaking change?
[x] Yes
[ ] No
A migration will be included to include <any> for every existing projector.
Other information
Deploy Preview for ngrx-io canceled.
| Name | Link |
|---|---|
| Latest commit | 57276e6c1c4b093a68cdc7653df91df5121ea91f |
| Latest deploy log | https://app.netlify.com/sites/ngrx-io/deploys/63625f66859866000875fc3b |
Not sure how to approach the migration (#3572).
Since the projector is found on arbitrary objects, then without compiling the code and inspecting type information, you could only naively update any call of a function named projector referenced as a property from an object.
Planning to update to remove the conditional generics this week.
What's the experience for someone upgrading from non-strict projectors? Are all their existing selectors going to produce type errors?
What's the experience for someone upgrading from non-strict projectors? Are all their existing selectors going to produce type errors?
Anywhere a projector is called, it will be required to be called with the correct arguments. Projectors called with incorrect arguments will produce errors.
Ok, we definitely need to provide instructions on how to work around this for existing users in the migration guide, as I'm sure there will be some breakages for existing apps.
Ok, we definitely need to provide instructions on how to work around this for existing users in the migration guide, as I'm sure there will be some breakages for existing apps.
I'll look to add to this PR.
LGTM 🎉
We should also provide the same changes to
MemoizedSelectorWithPropsin a follow-up PR.
I assumed, since they're deprecated, they shouldn't receive updates.