TypeScript, Self Driving Car, Step 11, error TS2554

Hi,
I’m up to this very last project in the TypeScript course, Step 11. There is also this walkthrough video for comparison… I can’t see what is different in my code but I get the below error.

N.B. In the codecademy instructions it says to set the value name to .isRunning whereas in the video walkthrough it is isRunning. I have tried it both with and without the ‘.

When I transpile the Typescript, I get this error message:

index.ts:19:29 - error TS2554: Expected 0 arguments, but got 1.

19 let autonomousCar = new Car({ isRunning: true });
                               ~~~~~~~~~~~~~~~~~~~

Found 1 error.

This is the index.ts file:

import { getObstacleEvents } from './computer-vision';

interface AutonomousCar {
  isRunning?: boolean;
}

interface AutonomousCarProps {
  isRunning?: boolean;
}

class Car implements AutonomousCar {
  isRunning;

  constuctor(props: AutonomousCarProps) {
    this.isRunning = props.isRunning;
  }
}

let autonomousCar = new Car({ isRunning: true });

console.log(autonomousCar.isRunning);

Many thanks in advance for any insight you can shed :slight_smile:

@lucitemple Trying to help with this issue was fun as I have yet to fully learn TS, so it forced me to dig and learn for a little while.
After some time I figured out the system was not treating your constructor class as the actual constructor. I could call it after defining the autonomousCar variable with an empty new Car()
A long time later, I got to the root of the problem. You have a typo in
constuctor(props: AutonomousCarProps)
once you fix it to constructor everything works as you expect. :sweat_smile:

1 Like

Thanks @ivan-avila ! Gosh, I can’t believe how much time I spent staring at that and not seeing it! It all works with the typo corrected!