fix: use object create if entity skip constructor is set (#9831)

This commit is contained in:
Joe Mizzi 2023-04-06 02:26:00 -05:00 committed by GitHub
parent bc306fb5a2
commit a8689795da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,10 +199,10 @@ export class EmbeddedMetadata {
return {}
}
if (!options?.fromDeserializer || this.isAlwaysUsingConstructor) {
return new (this.type as any)()
} else {
if (options?.fromDeserializer || !this.isAlwaysUsingConstructor) {
return Object.create(this.type.prototype)
} else {
return new (this.type as any)()
}
}