Is there a neater/more elegant way to cast day as the appropriate type, rather than (<{P: string}>day).P without resorting to the any type in this instance where I receive a day object from underscore.js via the findWhere command?
If I just write let period of day.P it results in this error:
TS2339:Property 'P' does not exist on type '{}'.
let day = _.findWhere(this.availabilityDays, {D: moment($scope.model.BookDate).format('YYYY-MM-DD')});
this.$scope.BookingPeriods.splice(0);
for (let period of (<{P: string}>day).P) {
this.$scope.BookingPeriods.push(period);
}