Repository navigation
Conversation
These changes address an overload resolution issue whereby Injector.get calls would resolve to the deprecated overload, disabling all type checks with an 'any' return type. BREAKING CHANGE: Applications may need to be corrected for revealed type errors. Applications explicitly specifying the generic argument to the method should remove the generic argument in favor of type inference.
|
FYI: I'm trying to contribute from a Windows machine and am unable to build, hence the commit to manually updating the public API golden files. Any advise would be appreciated. |
|
Can someone restart the automated checks? It looks like an unexpected failure for both (429 Too Many Requests). |
|
Hi @ts2do, and thanks for the PR. As far as I can tell, this does actually cause test failures (probably related to the breaking change). As it is, though, I don't think we can accept this PR until Angular 7, when we can make this kind of breaking change. I definitely think we should make |
|
If this will get merged in v7, possibly #11813 should be considered as well? |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
fix(core): refine Injector.get declaration to infer correct return type
These changes address an overload resolution issue whereby Injector.get
calls would resolve to the deprecated overload, disabling all type
checks with an 'any' return type.
BREAKING CHANGE:
Applications may need to be corrected for revealed type errors.
Applications explicitly specifying the generic argument to the method
should remove the generic argument in favor of type inference.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Given
xof typeType<T>|InjectionToken<T>andyof typeU(excludingTHROW_IF_NOT_NULLandundefined):injector.get(x, undefined)isanyinjector.get(x, THROW_IF_NOT_NULL)isanyinjector.get(x, y)isanyinjector.get(x, someCondition ? y : THROW_IF_NOT_NULL)isanyWhat is the new behavior?
injector.get(x, undefined)isTinjector.get(x, THROW_IF_NOT_NULL)isTinjector.get(x, y)isT|U.injector.get(x, someCondition ? y : THROW_IF_NOT_NULL)isT|UDoes this PR introduce a breaking change?
Any application injecting Injector may be affected. Applications may need to be corrected for revealed type errors. Applications explicitly specifying the generic argument to the method should remove the generic argument in favor of type inference.