File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -672,8 +672,8 @@ export default class Form<
672
672
673
673
// Removing undefined, null and empty errors.
674
674
const filterNilOrEmptyErrors = ( errors : any , previousCustomValidateErrors : any = { } ) : ErrorSchema < T > => {
675
- _forEach ( errors , ( errorAtKey , errorKey : keyof typeof errors ) => {
676
- const prevCustomValidateErrorAtKey = previousCustomValidateErrors [ errorKey ] ;
675
+ _forEach ( errors , ( errorAtKey : ErrorSchema < T > [ '__errors' ] | undefined , errorKey : keyof typeof errors ) => {
676
+ const prevCustomValidateErrorAtKey : ErrorSchema < T > | undefined = previousCustomValidateErrors [ errorKey ] ;
677
677
if ( _isNil ( errorAtKey ) || ( Array . isArray ( errorAtKey ) && errorAtKey . length === 0 ) ) {
678
678
delete errors [ errorKey ] ;
679
679
} else if (
Original file line number Diff line number Diff line change @@ -197,15 +197,16 @@ export function getAllPermutationsOfXxxOf<S extends StrictRJSFSchema = RJSFSchem
197
197
export function getMatchingPatternProperties < S extends StrictRJSFSchema = RJSFSchema > (
198
198
schema : S ,
199
199
key : string ,
200
- ) : S [ 'patternProperties' ] {
200
+ ) : Required < S [ 'patternProperties' ] > {
201
201
return Object . keys ( schema . patternProperties ! )
202
- . filter ( ( pattern ) => RegExp ( pattern ) . test ( key ) )
202
+ . filter ( ( pattern : string ) => RegExp ( pattern ) . test ( key ) )
203
203
. reduce (
204
204
( obj , pattern ) => {
205
- obj [ pattern ] = schema . patternProperties ! [ pattern ] ;
205
+ // Pass the pattern using the `[]` index notation so that any `.` in the pattern are not used as a dotted path
206
+ set ( obj , [ pattern ] , schema . patternProperties ! [ pattern ] ) ;
206
207
return obj ;
207
208
} ,
208
- { } as S [ 'patternProperties' ] ,
209
+ { } as Required < S [ 'patternProperties' ] > ,
209
210
) ;
210
211
}
211
212
You can’t perform that action at this time.
0 commit comments