-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constructor and undefined parameters #89
Comments
Hey @SingeImpetus,
The idea is that the source JSON should represent the public/serializable portion of your class, and not act as a source of data used to build up your objects manually. If you need to do additional stuff when deserializing, you should be able to use
|
Ok, I see. I'll look for the setter/getter use. |
Sorry SingeImpetus for such a delayed response from me, I somehow must have missed you issue. I have added tests for |
Hello,
I'm a bit new to TypeScript, so forgive me if I just made some stupid rookie mistake.
But when defining a simple class,
with a serialized/deserialized member and one not s/d, for whom I would derive a value from the s/d member in the constructor,
it appears the constructor get called with undefined value for parameters:
used to serialized the following file:
this.hour
stays undefined andthis.test
equals"wrong init"
=> constructor is called, but with an undefinedtimeString
parameter.The s/d member get its json's value after the call, so not the one set in the constructor, seems already a bit hard.
But am I doing something wrong?
How am I supposed to init my whole object if it's not in its constructor?
I looked in your source files, and found in
deserializer.ts
a call for the constructor without the deserialized values:and "then"
I'm investigating it by myself, since I'm not sure it's the only constructor call,
but was there a reason to not pass the serialized parameters to the constructor during the process?
The text was updated successfully, but these errors were encountered: