Skip to content

Commit ce7a43a

Browse files
swseverancealxhub
authored andcommitted
refactor(forms): improve clarity in SelectMultipleControlValueAccessor.writeValue
Rename the _optionMap forEach parameter from `o` to `id` and tighten its type from `any` to `string`, removing the now-redundant `.toString()` call. (cherry picked from commit cd20dd0)
1 parent af74b42 commit ce7a43a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/forms/src/directives/select_multiple_control_value_accessor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ export class SelectMultipleControlValueAccessor
126126
*/
127127
writeValue(value: any): void {
128128
this.value = value;
129-
let optionSelectedStateSetter: (opt: ɵNgSelectMultipleOption, o: any) => void;
129+
let optionSelectedStateSetter: (opt: ɵNgSelectMultipleOption, id: string) => void;
130130
if (Array.isArray(value)) {
131131
// convert values to ids
132132
const ids = value.map((v) => this._getOptionId(v));
133-
optionSelectedStateSetter = (opt, o) => {
134-
opt._setSelected(ids.indexOf(o.toString()) > -1);
133+
optionSelectedStateSetter = (opt, id) => {
134+
opt._setSelected(ids.indexOf(id) > -1);
135135
};
136136
} else {
137-
optionSelectedStateSetter = (opt, o) => {
137+
optionSelectedStateSetter = (opt) => {
138138
opt._setSelected(false);
139139
};
140140
}

0 commit comments

Comments
 (0)