Skip to content

Commit 8b6cfce

Browse files
committed
fixed failing issue because of type change
1 parent 9e8bd14 commit 8b6cfce

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/utils/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ export interface ValidatorType<T = any, S extends StrictRJSFSchema = RJSFSchema,
10371037
/** An optional function that can be used to reset validator implementation. Useful for clear schemas in the AJV
10381038
* instance for tests.
10391039
*/
1040-
reset: () => void;
1040+
reset?: () => void;
10411041
}
10421042

10431043
/** The `SchemaUtilsType` interface provides a wrapper around the publicly exported APIs in the `@rjsf/utils/schema`

packages/utils/test/schema/getDefaultFormStateTest.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,9 @@ const testObjectDefault = (testValidator: TestValidatorType, expectList: ObjectD
581581
});
582582

583583
// Reset the testValidator
584-
testValidator?.reset();
584+
if (typeof testValidator.reset === 'function') {
585+
testValidator?.reset();
586+
}
585587
});
586588
it('test oneOf with const values and constAsDefaults is always', () => {
587589
schema = {
@@ -638,6 +640,11 @@ type ArrayDefaultExpectList = [IExpectType, IExpectType, IExpectType, IExpectTyp
638640
*/
639641
const testArrayDefault = (testValidator: TestValidatorType, expectList: ArrayDefaultExpectList) => {
640642
describe('test array default', () => {
643+
// Reset the testValidator
644+
if (typeof testValidator.reset === 'function') {
645+
testValidator?.reset();
646+
}
647+
641648
it('test an array with defaults with no formData', () => {
642649
const schema: RJSFSchema = {
643650
type: 'array',

0 commit comments

Comments
 (0)