Open
Description
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
Hey π !
There are currently two inject()
functions that have two completely distinct purposes and signatures: @angular/core
s and @angular/core/testing
's.
This can be misleading and harm the Developer eXperience. (I already had some trouble with IDEs preferring to automatically import @angular/core/testing
instead of @angular/core
.)
π€ This reminds me of async
=> waitForAsync
renaming
Proposed solution
IMO, @angular/core/testing
's inject()
is not widely used and we could simply deprecate before we remove it in a future version. We could also ship a migration schematic that "simply" replaces:
inject([A, B], (a, b) => {...})
with
(a = inject(A), b = inject(B)) => {...}
Alternatives considered
Rename @angular/core/testing
's inject()
to something else... maybe nostalgicInject()