JS

TypeScript Quiz - assignments generate any type er...

5.

Will the following assignments generate any type errors?

  let num: number = 5;
  let str: string = "hello";
  let bool: boolean = true;
  let arr: number[] = [1, 2, 3];
  let obj: { name: string, age: number } = { name: 5, age: "John" };

Yes, the assignment of obj should have a number for the age property and a string for the name property.

Yes, the assignment of str should be number.

Yes, the assignment of num should be string.

No, all assignments are type-safe.