fix(forms): type NG_VALUE_ACCESSOR injection token as array (#29723)
NG_VALUE_ACCESSOR is a multi injection token, users can and should expect more than one ControlValueAccessor to be available (and this is how it is used in @angular/forms). This is now reflected in the definition of the injection token by typing it as an array of ControlValueAccessor. The motivating reason is that using the programmatic Injector api will now type Injector#get correspondingly. fixes #29351 BREAKING CHANGES NG_VALUE_ACCESSOR is now typed as a readonly array rather than a mutable scalar. It is used as a multi injection token and as such it should always be expected that more than one accessor may be returned. PR Close #29723
This commit is contained in:
@ -138,4 +138,5 @@ export interface ControlValueAccessor {
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const NG_VALUE_ACCESSOR = new InjectionToken<ControlValueAccessor>('NgValueAccessor');
|
||||
export const NG_VALUE_ACCESSOR =
|
||||
new InjectionToken<ReadonlyArray<ControlValueAccessor>>('NgValueAccessor');
|
||||
|
Reference in New Issue
Block a user