fix: object returning original elements instead of new object
This commit is contained in:
parent
5851f7779a
commit
bd9e0bcffe
@ -27,6 +27,7 @@ export default class SchemaObject<T extends Record<string, SchemaItem> = any> ex
|
||||
}
|
||||
|
||||
const clone = objectClone(object)
|
||||
const res: ModelInfer<T> = {} as ModelInfer<T>
|
||||
|
||||
// loop through the childs
|
||||
objectLoop(this.model, (childSchema, key) => {
|
||||
@ -45,7 +46,7 @@ export default class SchemaObject<T extends Record<string, SchemaItem> = 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<T extends Record<string, SchemaItem> = any> ex
|
||||
return {
|
||||
valid: errors.length === 0,
|
||||
errors: errors,
|
||||
object: clone
|
||||
object: res
|
||||
} as ValidationResult<ModelInfer<T>>
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user