Prevent error from unexpected attribute

This commit is contained in:
barsdeveloper
2023-01-04 22:16:51 +01:00
parent 3c5017de91
commit af44de4539
10 changed files with 65 additions and 39 deletions

View File

@@ -25,7 +25,8 @@ import Utility from "../Utility"
/**
* @template {AnyValue} T
* @typedef {(new () => T) | EntityConstructor | StringConstructor | NumberConstructor | BigIntConstructor | BooleanConstructor | ArrayConstructor} AnyValueConstructor
* @typedef {(new () => T) | EntityConstructor | StringConstructor | NumberConstructor | BigIntConstructor
* | BooleanConstructor | ArrayConstructor} AnyValueConstructor
*/
export default class IEntity {
@@ -54,6 +55,12 @@ export default class IEntity {
/** @type {AttributeInformation} */
let attribute = attributes[attributeName]
if (!attribute) {
// Remember attributeName can come from the values and be not defined in the attributes
target[attributeName] = value
continue
}
if (attribute instanceof SubAttributesDeclaration) {
target[attributeName] = {}
defineAllAttributes(