title: Aurelia - Typescript - Trouble with setting single value in a complex data structure
body: <p>I have been having all sorts of trouble with this.</p>
  
  <p>I have a class "client.ts" that is instantiated which has another class as part of its structure - "address.ts".  In Address I have "addressLocation.ts" and its here I need to set "stateShortName" to "VIC"  I need to set a value on that class and I am having trouble with this.</p>
  
  <p>The client class is:</p>
  
  <pre><code>    import { Serializable } from "../../../../services/serializable/Serializable"
  
      import { AddressDetails } from "../address/addressDetails"
      import { JobDetails } from "../../jobs/jobDetail/jobDetails"
  
      export class ClientDetails implements Serializable&lt;ClientDetails&gt; {
  
          clientId: number;
          clientNo: number;
          company: boolean;
          companyName: string;
          abn: string;
          isWarrantyCompany: boolean;
          requiresPartsPayment: boolean;
          clientFirstName: string;
          clientLastName: string;
          email: string;
          mobilePhone: string;
          phone: string;
          notes: string;
  
          address: AddressDetails = "new AddressDetails";
  
          jobs: JobDetails[];
  
          bankName: string;
          bankBSB: string;
          bankAccount: string;
          active: boolean;
          deActivated: string;
          activity: boolean;
  
          creatorId: number;
          creatorName: string;
          dateCreated: string;
  
          updatorId: number;
          updatorName: string;
          dateUpdated: string;
  
          deserialize(input) {
  
              this.clientId = input.clientId;
              this.clientNo = input.clientNo;
              this.company = input.company;
              this.companyName = input.companyName;
              this.abn = input.abn;
              this.isWarrantyCompany = input.isWarrantyCompany;
              this.requiresPartsPayment = input.requiresPartsPayment;
              this.clientFirstName = input.clientFirstName;
              this.clientLastName = input.clientLastName;
              this.email = input.email;
              this.mobilePhone = input.mobilePhone;
              this.phone = input.phone;
              this.notes = input.notes;
              this.bankName = input.bankName;
              this.bankBSB = input.bankBSB;
              this.bankAccount = input.bankAccount;
              this.active = input.active;
              this.deActivated = input.deActivated;
              this.activity = input.activity;
              this.creatorId = input.creatorId;
              this.creatorName = input.creatorName;
              this.dateCreated = input.dateCreated;
              this.updatorId = input.updatorId;
              this.updatorName = input.updatorName;
              this.dateUpdated = input.dateUpdated;
  
              if (input.jobs) {
  
                  this.jobs = new Array&lt;JobDetails&gt;();
  
                  for (let count = 0; count &lt; input.jobs.length; count++) {
  
                      let job = new JobDetails;
  
                      this.jobs.push(job.deserialize(input.jobs[count]));
                  }
              }
  
              if (input.address) {
  
                  this.address = new AddressDetails;
  
                  this.address.deserialize(input.address);
              }
  
              return this;
          }
  
          deserializeAddressStateShortName(input) {
  
          }
      }
  </code></pre>
  
  <p>It has the address class set as "new AddressDetails".</p>
  
  <p>The address class is as follows:</p>
  
  <pre><code>    import { Serializable } from "../../../../services/serializable/Serializable"
  
      import { AddressLocation } from "./addressLocation"
  
  
      export class AddressDetails implements Serializable&lt;AddressDetails&gt; {
          address1?: string;
          address2?: string;
  
          addressLocation: AddressLocation;
  
          deserialize(input) {
              //console.log("INPUT: ", input)
              this.address1 = input.address1;
              this.address2 = input.address2;
  
              if (input.addressLocation) {
  
                  this.addressLocation = new AddressLocation;
  
                  this.addressLocation.deserialize(input.addressLocation);
              }
  
              return this;
          }
      }
  </code></pre>
  
  <p>Address has "addressLocation" set as "new AddressLocation"</p>
  
  <pre><code>    import { Serializable } from "../../../../services/serializable/Serializable"
  
  
      export class AddressLocation implements Serializable&lt;AddressLocation&gt; {
          addressLocationId?: number;
          suburb?: string;
          postcode?: string;
          stateShortName?: string;
  
          set stateName(name: string) {
              this.stateShortName = name;
  
          }
  
          deserialize(input) {
              this.addressLocationId = input.addressLocationId;
              this.suburb = input.suburb;
              this.postcode = input.postcode;
              this.stateShortName = input.stateShortName;
  
              return this;
          }
      }
  </code></pre>
  
  <p>each one can be initialized using the "deserialized" function.</p>
  
  <p>I do a fetch and I use the data from the fetch in "client" which then populates "address" and subsequently "addressLocation".</p>
  
  <p>Fine.  It works when I fetch and the client object is set using <code>this.client.deserialize(data)</code> and the object is populated.</p>
  
  <p>I dont want to go through the entire set of values just to set one value in addressLocation.</p>
  
  <p>How do I, once I have created client using <code>client = new ClientDetails();</code>, set the value of "stateShortName" in <code>this.client.address.addressLocation.stateShortName</code>?  I dont know how to just poplutate that value?</p>