diff --git a/src/items/object.ts b/src/items/object.ts index 5c6d994..702ea7d 100644 --- a/src/items/object.ts +++ b/src/items/object.ts @@ -27,6 +27,7 @@ export default class SchemaObject = any> ex } const clone = objectClone(object) + const res: ModelInfer = {} as ModelInfer // loop through the childs objectLoop(this.model, (childSchema, key) => { @@ -45,7 +46,7 @@ export default class SchemaObject = any> ex // @ts-expect-error while it's a generic we know by proof above that it's valid ! // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - clone[key] = child.object + res[key] = child.object // skip rest of items if current one is invalid return child.valid || !options?.fast @@ -55,7 +56,7 @@ export default class SchemaObject = any> ex return { valid: errors.length === 0, errors: errors, - object: clone + object: res } as ValidationResult> }