@@ -238,11 +238,11 @@ export abstract class AbstractControl {
238238 * This will also mark all direct ancestors as `touched` to maintain
239239 * the model.
240240 */
241- markAsTouched ( { onlySelf } : { onlySelf ?: boolean } = { } ) : void {
241+ markAsTouched ( opts : { onlySelf ?: boolean } = { } ) : void {
242242 this . _touched = true ;
243243
244- if ( this . _parent && ! onlySelf ) {
245- this . _parent . markAsTouched ( { onlySelf } ) ;
244+ if ( this . _parent && ! opts . onlySelf ) {
245+ this . _parent . markAsTouched ( opts ) ;
246246 }
247247 }
248248
@@ -253,14 +253,14 @@ export abstract class AbstractControl {
253253 * to maintain the model, and re-calculate the `touched` status of all parent
254254 * controls.
255255 */
256- markAsUntouched ( { onlySelf } : { onlySelf ?: boolean } = { } ) : void {
256+ markAsUntouched ( opts : { onlySelf ?: boolean } = { } ) : void {
257257 this . _touched = false ;
258258
259259 this . _forEachChild (
260260 ( control : AbstractControl ) => { control . markAsUntouched ( { onlySelf : true } ) ; } ) ;
261261
262- if ( this . _parent && ! onlySelf ) {
263- this . _parent . _updateTouched ( { onlySelf } ) ;
262+ if ( this . _parent && ! opts . onlySelf ) {
263+ this . _parent . _updateTouched ( opts ) ;
264264 }
265265 }
266266
@@ -270,11 +270,11 @@ export abstract class AbstractControl {
270270 * This will also mark all direct ancestors as `dirty` to maintain
271271 * the model.
272272 */
273- markAsDirty ( { onlySelf } : { onlySelf ?: boolean } = { } ) : void {
273+ markAsDirty ( opts : { onlySelf ?: boolean } = { } ) : void {
274274 this . _pristine = false ;
275275
276- if ( this . _parent && ! onlySelf ) {
277- this . _parent . markAsDirty ( { onlySelf } ) ;
276+ if ( this . _parent && ! opts . onlySelf ) {
277+ this . _parent . markAsDirty ( opts ) ;
278278 }
279279 }
280280
@@ -285,24 +285,24 @@ export abstract class AbstractControl {
285285 * to maintain the model, and re-calculate the `pristine` status of all parent
286286 * controls.
287287 */
288- markAsPristine ( { onlySelf } : { onlySelf ?: boolean } = { } ) : void {
288+ markAsPristine ( opts : { onlySelf ?: boolean } = { } ) : void {
289289 this . _pristine = true ;
290290
291291 this . _forEachChild ( ( control : AbstractControl ) => { control . markAsPristine ( { onlySelf : true } ) ; } ) ;
292292
293- if ( this . _parent && ! onlySelf ) {
294- this . _parent . _updatePristine ( { onlySelf } ) ;
293+ if ( this . _parent && ! opts . onlySelf ) {
294+ this . _parent . _updatePristine ( opts ) ;
295295 }
296296 }
297297
298298 /**
299299 * Marks the control as `pending`.
300300 */
301- markAsPending ( { onlySelf } : { onlySelf ?: boolean } = { } ) : void {
301+ markAsPending ( opts : { onlySelf ?: boolean } = { } ) : void {
302302 this . _status = PENDING ;
303303
304- if ( this . _parent && ! onlySelf ) {
305- this . _parent . markAsPending ( { onlySelf } ) ;
304+ if ( this . _parent && ! opts . onlySelf ) {
305+ this . _parent . markAsPending ( opts ) ;
306306 }
307307 }
308308
@@ -312,18 +312,18 @@ export abstract class AbstractControl {
312312 *
313313 * If the control has children, all children will be disabled to maintain the model.
314314 */
315- disable ( { onlySelf , emitEvent } : { onlySelf ?: boolean , emitEvent ?: boolean } = { } ) : void {
315+ disable ( opts : { onlySelf ?: boolean , emitEvent ?: boolean } = { } ) : void {
316316 this . _status = DISABLED ;
317317 this . _errors = null ;
318318 this . _forEachChild ( ( control : AbstractControl ) => { control . disable ( { onlySelf : true } ) ; } ) ;
319319 this . _updateValue ( ) ;
320320
321- if ( emitEvent !== false ) {
321+ if ( opts . emitEvent !== false ) {
322322 this . _valueChanges . emit ( this . _value ) ;
323323 this . _statusChanges . emit ( this . _status ) ;
324324 }
325325
326- this . _updateAncestors ( ! ! onlySelf ) ;
326+ this . _updateAncestors ( ! ! opts . onlySelf ) ;
327327 this . _onDisabledChange . forEach ( ( changeFn ) => changeFn ( true ) ) ;
328328 }
329329
@@ -334,12 +334,12 @@ export abstract class AbstractControl {
334334 *
335335 * If the control has children, all children will be enabled.
336336 */
337- enable ( { onlySelf , emitEvent } : { onlySelf ?: boolean , emitEvent ?: boolean } = { } ) : void {
337+ enable ( opts : { onlySelf ?: boolean , emitEvent ?: boolean } = { } ) : void {
338338 this . _status = VALID ;
339339 this . _forEachChild ( ( control : AbstractControl ) => { control . enable ( { onlySelf : true } ) ; } ) ;
340- this . updateValueAndValidity ( { onlySelf : true , emitEvent} ) ;
340+ this . updateValueAndValidity ( { onlySelf : true , emitEvent : opts . emitEvent } ) ;
341341
342- this . _updateAncestors ( ! ! onlySelf ) ;
342+ this . _updateAncestors ( ! ! opts . onlySelf ) ;
343343 this . _onDisabledChange . forEach ( ( changeFn ) => changeFn ( false ) ) ;
344344 }
345345
@@ -373,8 +373,7 @@ export abstract class AbstractControl {
373373 *
374374 * By default, it will also update the value and validity of its ancestors.
375375 */
376- updateValueAndValidity ( { onlySelf, emitEvent} : { onlySelf ?: boolean , emitEvent ?: boolean } = { } ) :
377- void {
376+ updateValueAndValidity ( opts : { onlySelf ?: boolean , emitEvent ?: boolean } = { } ) : void {
378377 this . _setInitialStatus ( ) ;
379378 this . _updateValue ( ) ;
380379
@@ -384,24 +383,24 @@ export abstract class AbstractControl {
384383 this . _status = this . _calculateStatus ( ) ;
385384
386385 if ( this . _status === VALID || this . _status === PENDING ) {
387- this . _runAsyncValidator ( emitEvent ) ;
386+ this . _runAsyncValidator ( opts . emitEvent ) ;
388387 }
389388 }
390389
391- if ( emitEvent !== false ) {
390+ if ( opts . emitEvent !== false ) {
392391 this . _valueChanges . emit ( this . _value ) ;
393392 this . _statusChanges . emit ( this . _status ) ;
394393 }
395394
396- if ( this . _parent && ! onlySelf ) {
397- this . _parent . updateValueAndValidity ( { onlySelf , emitEvent } ) ;
395+ if ( this . _parent && ! opts . onlySelf ) {
396+ this . _parent . updateValueAndValidity ( opts ) ;
398397 }
399398 }
400399
401400 /** @internal */
402- _updateTreeValidity ( { emitEvent } : { emitEvent ?: boolean } = { emitEvent : true } ) {
403- this . _forEachChild ( ( ctrl : AbstractControl ) => ctrl . _updateTreeValidity ( { emitEvent } ) ) ;
404- this . updateValueAndValidity ( { onlySelf : true , emitEvent} ) ;
401+ _updateTreeValidity ( opts : { emitEvent ?: boolean } = { emitEvent : true } ) {
402+ this . _forEachChild ( ( ctrl : AbstractControl ) => ctrl . _updateTreeValidity ( opts ) ) ;
403+ this . updateValueAndValidity ( { onlySelf : true , emitEvent : opts . emitEvent } ) ;
405404 }
406405
407406 private _setInitialStatus ( ) { this . _status = this . _allControlsDisabled ( ) ? DISABLED : VALID ; }
@@ -448,9 +447,9 @@ export abstract class AbstractControl {
448447 * expect(login.valid).toEqual(true);
449448 * ```
450449 */
451- setErrors ( errors : ValidationErrors | null , { emitEvent } : { emitEvent ?: boolean } = { } ) : void {
450+ setErrors ( errors : ValidationErrors | null , opts : { emitEvent ?: boolean } = { } ) : void {
452451 this . _errors = errors ;
453- this . _updateControlsErrors ( emitEvent !== false ) ;
452+ this . _updateControlsErrors ( opts . emitEvent !== false ) ;
454453 }
455454
456455 /**
@@ -556,20 +555,20 @@ export abstract class AbstractControl {
556555 }
557556
558557 /** @internal */
559- _updatePristine ( { onlySelf } : { onlySelf ?: boolean } = { } ) : void {
558+ _updatePristine ( opts : { onlySelf ?: boolean } = { } ) : void {
560559 this . _pristine = ! this . _anyControlsDirty ( ) ;
561560
562- if ( this . _parent && ! onlySelf ) {
563- this . _parent . _updatePristine ( { onlySelf } ) ;
561+ if ( this . _parent && ! opts . onlySelf ) {
562+ this . _parent . _updatePristine ( opts ) ;
564563 }
565564 }
566565
567566 /** @internal */
568- _updateTouched ( { onlySelf } : { onlySelf ?: boolean } = { } ) : void {
567+ _updateTouched ( opts : { onlySelf ?: boolean } = { } ) : void {
569568 this . _touched = this . _anyControlsTouched ( ) ;
570569
571- if ( this . _parent && ! onlySelf ) {
572- this . _parent . _updateTouched ( { onlySelf } ) ;
570+ if ( this . _parent && ! opts . onlySelf ) {
571+ this . _parent . _updateTouched ( opts ) ;
573572 }
574573 }
575574
0 commit comments