TS7061

A 'return' statement can only be used within a function body.

Broken Code ❌

const value = 42;
return value;

Fixed Code ✔️

function getValue() {
  const value = 42;
  return value;
}

Alternative:

const getValue = () => {
  const value = 42;
  return value;
};

The return statement must be inside a function or method body. Move your code into a function.