@colyseus/schema 3.0.73 → 3.0.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3589,7 +3589,13 @@ function schema(fieldsAndMethods, name, inherits = Schema) {
3589
3589
  // call initialize method
3590
3590
  if (methods.initialize && typeof methods.initialize === 'function') {
3591
3591
  super(Object.assign({}, getDefaultValues(), getParentProps(args[0] || {})));
3592
- methods.initialize.apply(this, args);
3592
+ /**
3593
+ * only call initialize() in the current class, not the parent ones.
3594
+ * see "should not call initialize automatically when creating an instance of inherited Schema"
3595
+ */
3596
+ if (new.target === klass) {
3597
+ methods.initialize.apply(this, args);
3598
+ }
3593
3599
  }
3594
3600
  else {
3595
3601
  super(Object.assign({}, getDefaultValues(), args[0] || {}));