You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is most likely an issue w/ Babel, and may be related to this issue, but I wanted to post this to see if someone might be able to help me.
Say I have the following classes defined:
A=classA{constructor(value,options){this.value=value;this.options=options;console.log('constructor this: ',this);}getvalue(){returnthis._value;}setvalue(value){this._value=value;}getoptions(){returnthis._options;}setoptions(options){this._options=options;}getvalidationErrors(){// Do standard validations for all classes of type A hereconsole.log('A.validationErrors this: ',this);varvalidationErrs=[];if(options&&options.required&&!value){validationErrs.push('Value is required');}returnvalidationErrs;}}B=classBextendsA{getvalidationErrors(){console.log('B.validationErrors this: ',this);varvalErrs=super.validationErrors;// Do custom validations for class B herereturnvalErrs;}}varb=newB('val',{required: true});varvalErrs=b.validationErrors;
Furthermore, if I call this.value or this.options in the parent's validationErrors, I end up with undefined returned. It seems like the constructor and getters are being copied down, at least in behavior, but they shouldn't be, right? I would think that the child's constructor would simply call the parent's in this case, but that doesn't seem to be happening.
The text was updated successfully, but these errors were encountered:
This is most likely an issue w/ Babel, and may be related to this issue, but I wanted to post this to see if someone might be able to help me.
Say I have the following classes defined:
Strangely, what I see in the logs is:
Furthermore, if I call
this.value
orthis.options
in the parent'svalidationErrors
, I end up with undefined returned. It seems like the constructor and getters are being copied down, at least in behavior, but they shouldn't be, right? I would think that the child's constructor would simply call the parent's in this case, but that doesn't seem to be happening.The text was updated successfully, but these errors were encountered: