I have two classes that inherit from the same superclass:
class Vehicle {}
class Bus extends Vehicle {}
class Truck extends Vehicle {}
Let's have two typed arrays:
var buses : Bus[];
var trucks : Truck[];
and a function that accepts an array of the superclass type.
function checkOil(vehicles : Vehicle[]) {}
I can pass in array of busses or array of trucks but I can not merge them and pass them together:
function checkOil(buses.concat(trucks));
//error TS2082: Supplied parameters do not match any signature of call target:
Types of property 'pop' of types 'Bus[]' and 'Track[]' are incompatible:
How do I merge those arrays?
EDIT: TypeScript Playground
Vehicles. Why do you want to do that?