TS2322

Type 'string' is not assignable to type 'number'.

Broken Code ❌

export function add(a: number, b: number): number {
  return `${a + b}`;
}

Fixed Code ✔️

The type of the returned value must match the return type specified in the function signature:

export function add(a: number, b: number): number {
  return parseInt(`${a + b}`, 10);
}

Video Tutorial