ORIGINAL EXCEPTION: TypeError: LocationModel_1.LocationModel is not a constructor

I found something not very elegant. If I add var locationModel: LocationModel = new LocationModel(); outside the loop (not used), it seems to fix it, not sure why though. See it’s defined outside the loop, and then inside again where it was previously failing. So I guess it’s some scope issue.

  saveMarkers(): void {
    var locationModel: LocationModel = new LocationModel();
    var locationModels: LocationModel[] = [];
    for (var index = 0; index < this.markers.length; index++) {
      let marker: google.maps.Marker = this.markers[index];
      let location: google.maps.LatLng = marker.getPosition();
      var locationModel: LocationModel = new LocationModel();
      locationModel.latitude = location.lat();
      locationModel.longitude = location.lng();
      locationModels.push(locationModel);
    }
    this.employeeModel.locations = locationModels;
  }