title: Typescript: Property does not exist on type 'never', but function works?
body: <p>This is my code</p>
  
  <pre><code>sumDevices() {
  let onlineDevicesArray = [];
  let offlineDevicesArray = [];
  
  for(let group of this.groups[this.selectedDeviceSource.id]){
    for(let device of group.devices){
      if(device.onlineState == "Online"){
        onlineDevicesArray.push(device.onlineState);
        this.onlineDevices = onlineDevicesArray.length;}
      else{
        offlineDevicesArray.push(device.onlineState);
        this.offlineDevices = offlineDevicesArray.length;
      }
    }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>It gives an error on device.onlineState, but the function does work.</p>
  
  <pre><code>TS2339:Property 'onlineState' does not exist on type 'never'.
  </code></pre>
  
  <p><strong>Can anyone explain to me why its giving me this error?</strong></p>