Open natescode opened 3 weeks ago
Hi Nathan,
Thank you for your help.
I was able to get part of findVehicleToTow to work by using answers.vehicleToTow.
I tried
let towTruck = Truck;
towTruck.tow(answers.vehicleToTow).
Error message: Property 'tow' does not exist on type 'typeof Truck'.ts(2339)
Tried
var towTruck = this.selectedVehicleVin; towTruck.tow(answers.vehicleToTow);
Error messages: 'towTruck' is possibly 'undefined' and Property 'tow' does not exist on type 'string'.
Also tried
var towTruck = answers.vehicleToTow; towTruck.tow(this.selectedVehicleVin);
TypeError: towTruck.tow is not a function.
@natescode I figured out the issue and got tow & wheelie to work!
Cli.ts
Make sure to use the
answers
parameter passed to your.then
method to know which vehicle was selected. IF the vehicle selected is the truck, assign it to a variable and say that the truck cannot itself be towed. IF the vehicle selected is NOT the truck, find it and assign it to a variable. Have the user selected the vehicle that will be towed. Call the.tow
method on the truck i.e.truck.tow(selectedVehicle)
.