Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
const car = { type: "Toyota", }; car.type = "Ford"; // no error car.type = 2; // Error: Type 'number' is not assignable to type 'string'. console.log(car);
prog.ts(5,7): error TS2322: Type 'number' is not assignable to type 'string'.