hi i have the following models:
export class Vehicle {
}
export class Trike extends Vehicle {
}
export class Car extends Vehicle {
}
These are retrieve from a Mock of an API
var vehiclesResource = vehicleService.getResource();
vehiclesResource.query((data) => {
this.areas = data;
var c = data[0] instanceof Car;
var t = data[0] instanceof Trike;
var cc = data[0].constructor === Car;
var tt = data[0].constructor === Trike;
});
A car is retrieved from the API, now when the data arrives i want to cast it to the correct object (Car in this case). but some how c = false t = false cc = false and tt = false.
setting the breakpoint in visualstudio shows me the data is of the type Object (Resource)
what am i doing wrong?