Skip to content

Commit 1923b75

Browse files
- Fixed additional typing issues from the patternProperties rebase
1 parent 9a722e2 commit 1923b75

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/core/src/components/Form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,8 @@ export default class Form<
672672

673673
// Removing undefined, null and empty errors.
674674
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];
677677
if (_isNil(errorAtKey) || (Array.isArray(errorAtKey) && errorAtKey.length === 0)) {
678678
delete errors[errorKey];
679679
} else if (

packages/utils/src/schema/retrieveSchema.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,16 @@ export function getAllPermutationsOfXxxOf<S extends StrictRJSFSchema = RJSFSchem
197197
export function getMatchingPatternProperties<S extends StrictRJSFSchema = RJSFSchema>(
198198
schema: S,
199199
key: string,
200-
): S['patternProperties'] {
200+
): Required<S['patternProperties']> {
201201
return Object.keys(schema.patternProperties!)
202-
.filter((pattern) => RegExp(pattern).test(key))
202+
.filter((pattern: string) => RegExp(pattern).test(key))
203203
.reduce(
204204
(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]);
206207
return obj;
207208
},
208-
{} as S['patternProperties'],
209+
{} as Required<S['patternProperties']>,
209210
);
210211
}
211212

0 commit comments

Comments
 (0)