aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-forms
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-24 16:48:54 +0200
committerChocobozzz <me@florianbigard.com>2023-05-24 16:56:05 +0200
commit54909304287f3c04dcfb39660be8ead57dc95440 (patch)
tree478f1b913f3bd4c3bbaa17525f0114c5b0a8689d /client/src/app/shared/shared-forms
parentd0fbc9fd0a29c37f3ff9b99030351e90b276fe7d (diff)
downloadPeerTube-54909304287f3c04dcfb39660be8ead57dc95440.tar.gz
PeerTube-54909304287f3c04dcfb39660be8ead57dc95440.tar.zst
PeerTube-54909304287f3c04dcfb39660be8ead57dc95440.zip
Remove suppressImplicitAnyIndexErrors
It's deprecated by TS
Diffstat (limited to 'client/src/app/shared/shared-forms')
-rw-r--r--client/src/app/shared/shared-forms/form-validator.service.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/client/src/app/shared/shared-forms/form-validator.service.ts b/client/src/app/shared/shared-forms/form-validator.service.ts
index 897008242..14ee044b5 100644
--- a/client/src/app/shared/shared-forms/form-validator.service.ts
+++ b/client/src/app/shared/shared-forms/form-validator.service.ts
@@ -1,5 +1,6 @@
1import { Injectable } from '@angular/core' 1import { Injectable } from '@angular/core'
2import { AsyncValidatorFn, FormArray, FormBuilder, FormControl, FormGroup, ValidatorFn } from '@angular/forms' 2import { AsyncValidatorFn, FormArray, FormBuilder, FormControl, FormGroup, ValidatorFn } from '@angular/forms'
3import { objectKeysTyped } from '@shared/core-utils'
3import { BuildFormArgument, BuildFormDefaultValues } from '../form-validators/form-validator.model' 4import { BuildFormArgument, BuildFormDefaultValues } from '../form-validators/form-validator.model'
4import { FormReactiveErrors, FormReactiveValidationMessages } from './form-reactive.service' 5import { FormReactiveErrors, FormReactiveValidationMessages } from './form-reactive.service'
5 6
@@ -47,13 +48,14 @@ export class FormValidatorService {
47 obj: BuildFormArgument, 48 obj: BuildFormArgument,
48 defaultValues: BuildFormDefaultValues = {} 49 defaultValues: BuildFormDefaultValues = {}
49 ) { 50 ) {
50 for (const name of Object.keys(obj)) { 51 for (const name of objectKeysTyped(obj)) {
51 formErrors[name] = '' 52 formErrors[name] = ''
52 53
53 const field = obj[name] 54 const field = obj[name]
54 if (this.isRecursiveField(field)) { 55 if (this.isRecursiveField(field)) {
55 this.updateFormGroup( 56 this.updateFormGroup(
56 form[name], 57 // FIXME: typings
58 (form as any)[name],
57 formErrors[name] as FormReactiveErrors, 59 formErrors[name] as FormReactiveErrors,
58 validationMessages[name] as FormReactiveValidationMessages, 60 validationMessages[name] as FormReactiveValidationMessages,
59 obj[name] as BuildFormArgument, 61 obj[name] as BuildFormArgument,
@@ -67,7 +69,7 @@ export class FormValidatorService {
67 const defaultValue = defaultValues[name] || '' 69 const defaultValue = defaultValues[name] || ''
68 70
69 form.addControl( 71 form.addControl(
70 name, 72 name + '',
71 new FormControl(defaultValue, field?.VALIDATORS as ValidatorFn[], field?.ASYNC_VALIDATORS as AsyncValidatorFn[]) 73 new FormControl(defaultValue, field?.VALIDATORS as ValidatorFn[], field?.ASYNC_VALIDATORS as AsyncValidatorFn[])
72 ) 74 )
73 } 75 }
@@ -75,7 +77,8 @@ export class FormValidatorService {
75 77
76 updateTreeValidity (group: FormGroup | FormArray): void { 78 updateTreeValidity (group: FormGroup | FormArray): void {
77 for (const key of Object.keys(group.controls)) { 79 for (const key of Object.keys(group.controls)) {
78 const abstractControl = group.controls[key] as FormControl 80 // FIXME: typings
81 const abstractControl = (group.controls as any)[key] as FormControl
79 82
80 if (abstractControl instanceof FormGroup || abstractControl instanceof FormArray) { 83 if (abstractControl instanceof FormGroup || abstractControl instanceof FormArray) {
81 this.updateTreeValidity(abstractControl) 84 this.updateTreeValidity(abstractControl)