[Deprecation]: implicit injections#19358
Conversation
06af83b to
206379c
Compare
| _bucketCache: BucketCache | undefined; | ||
| _internalName!: string; | ||
| _names: unknown; | ||
| _router: EmberRouter | undefined; |
There was a problem hiding this comment.
How can we force this to be just _router: EmberRouter;?
packages/@ember/-internals/extension-support/tests/data_adapter_test.js
Outdated
Show resolved
Hide resolved
packages/@ember/-internals/extension-support/lib/data_adapter.js
Outdated
Show resolved
Hide resolved
4211123 to
4f4b9f0
Compare
| let factory = getFactoryFor(obj); | ||
| if (factory) { | ||
| for (let injection in factory.injections) { | ||
| if (factory.injections[injection] === properties[injection]) { |
There was a problem hiding this comment.
What is this checking? What is properties here?
There was a problem hiding this comment.
properties is Object.assign({}, injections, createProps) basically. So it's possible that the implicit injection has been overridden by an explicit value (an argument in a classic component for instance)
| } | ||
|
|
||
| ['@test does raise deprecation if descriptor is a getter and not equal to the implicit deprecation'](assert) { | ||
| ['@test does not raise deprecation if descriptor is a getter and not equal to the implicit deprecation']( |
There was a problem hiding this comment.
What this change intended? Based on the code changes, it seems so?
There was a problem hiding this comment.
Yes, after thinking about it some more my conclusion was that we can't really assert about getters, specifically because when a user defines a getter, they also must define a setter. Otherwise, the implicit injection will do nothing (or error, if JS strict mode is enabled). With that in mind, its possible that the user could define a setter that swallows the implicit injection, handling the deprecated behavior essentially.
Happy to discuss further if that doesn't make sense
Implements the implicit injections RFC
emberjs/rfcs#680
maybe ref #17791