Simple serialization entities fixes and tests

This commit is contained in:
barsdeveloper
2024-03-30 20:07:26 +01:00
parent acedafc339
commit 279163cd54
24 changed files with 315 additions and 146 deletions

View File

@@ -17,16 +17,18 @@ export default class Integer64Entity extends IEntity {
return Parsernostrum.numberBigInteger.map(v => new this(v))
}
/** @param {BigInt | Number} value */
constructor(value = 0) {
if (value.constructor !== Object) {
value = {
// @ts-expect-error
value: value,
/** @param {BigInt | Number | Object} values */
constructor(values = 0) {
if (values.constructor !== Object) {
values = {
value: values,
}
}
super(value)
/** @type {BigInt | Number} */ this.value
if (values.value === -0) {
values.value = 0n
}
super(values)
/** @type {BigInt} */ this.value
}
valueOf() {